Logo Search packages:      
Sourcecode: pwlib version File versions

int PChannel::ReadCharWithTimeout ( PTimeInterval timeout  )  [protected, inherited]

Read a character with specified timeout. This reads a single character from the channel waiting at most the amount of time specified for it to arrive. The timeout# parameter is adjusted for amount of time it actually took, so it can be used for a multiple character timeout.

Returns:
TRUE if there was no error.

Definition at line 348 of file pchannel.cxx.

References PChannel::ReadChar(), PChannel::SetReadTimeout(), and PTimer::Tick().

Referenced by PModem::Dial(), and PChannel::SendCommandString().

{
  SetReadTimeout(timeout);
  PTimeInterval startTick = PTimer::Tick();
  int c;
  if ((c = ReadChar()) < 0) // Timeout or aborted
    return -1;
  timeout -= PTimer::Tick() - startTick;
  return c;
}


Generated by  Doxygen 1.6.0   Back to index