CSocketWrench::IsReadable Method  
 
BOOL IsReadable(
  INT nTimeout,  
  LPDWORD lpdwAvail  
);

The IsReadable method is used to determine if data is available to be read from the remote host.

Parameters

nTimeout
Timeout for remote host response, in seconds. A value of zero specifies that the connection should be polled without blocking the current thread.
lpdwAvail
A pointer to an unsigned integer which will contain the number of bytes available to read. This parameter may be NULL if this information is not required.

Return Value

If the current thread can read data from the socket without blocking, the method returns a non-zero value. If the current thread cannot read any data without blocking, the function returns zero.

Remarks

On some platforms, this value will not exceed the size of the receive buffer (typically 64K bytes). Because of differences between TCP/IP stack implementations, it is not recommended that your application exclusively depend on this value to determine the exact number of bytes available. Instead, it should be used as a general indicator that there is data available to be read.

If the connection is secure, the value returned in lpdwAvail will reflect the number of bytes available in the encrypted data stream. The actual amount of data available to the application after it has been decrypted will vary.

Requirements

Minimum Desktop Platform: Windows 7 (Service Pack 1)
Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
Header: Include cswsock10.h
Import Library: cswskv10.lib

See Also

IsWritable, Peek, Read, ReadLine, ReadStream