Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

int PSocket::Select ( PSocket sock1,
PSocket sock2,
const PTimeInterval timeout 
) [static, inherited]

Select a socket with available data.

sock1  First socket to check for readability.
sock2  Second socket to check for readability.
timeout  Timeout for wait on read/write data.

Definition at line 1635 of file sockets.cxx.

References PChannel::ConvertOSError(), and PSocket::Select().

  SelectList read, dummy1, dummy2;
  read += sock1;
  read += sock2;

  Errors lastError;
  int osError;
  if (!ConvertOSError(Select(read, dummy1, dummy2, timeout), lastError, osError))
    return lastError;

  switch (read.GetSize()) {
    case 0 :
      return 0;
    case 2 :
      return -3;
    default :
      return &read[0] == &sock1 ? -1 : -2;

Generated by  Doxygen 1.6.0   Back to index