![]() |
|
| << Previous | Index | Next >> | |
| | |
int sock_aread( tcp_Socket *s, byte *dp, int len );
Description
Read exactly
lenbytes from the socket or, if that amount of data is not yet available, do not read anything. Unlikesock_fastread(), this function will never return less than the requested amount of data. This can be useful when the application knows that it will be receiving a fixed amount of data, but does not wish to handle the arrival of only part of the data, as it would have to do ifsock_fastread()was used.
lenmust be less than or equal to the socket receive buffer size, otherwisesock_fastread()must be used.This function is only valid for TCP sockets. It is available starting with DC 7.30.
Parameters
s
- Pointer to a TCP socket.
dp
- Buffer to place bytes that are read.
len
- Number of bytes to copy to the buffer.
Return Value
-1:lenis greater than the total socket receive buffer size, hence this request could never be satisfied in one call.
-2:The socket is closed or closing, but insufficient data is in the buffer to satisfy the request.
-3:len< 0 or the socket parameter was invalid.
0: Insufficient data is in the buffer to satisfy the request, orlenwas zero. Try again later since the socket is still able to receive data from the peer.
len: Thelenparameter is returned if there was sufficient data in the socket buffer to satisfy the request.Library
TCP.LIB
See Also
| TCP/IP Manual Vol 1 |
<<Previous | Index | Next>> | rabbit.com |