C
int recv( SOCKET s, char* buf, int len, int flags );
Description
The recv() function is used to receive incoming data that has been queued for a socket. This function can be used with both datagram and stream socket. If the available data is too large to fit in the supplied application buffer buf, excess bytes are discarded in case of SOCK_DGRAM type sockets. For SOCK_STREAM types, the data is buffered internally so the application can retreive all data by multiple calls of recvfrom.
Preconditions
Parameters
Parameters |
Description |
s |
Socket descriptor returned from a previous call to socket. |
buf |
application data receive buffer. |
len |
buffer length in bytes. |
flags |
no significance in this implementation |
Returns
If recv is successful, the number of bytes copied to application buffer buf is returned. A value of zero indicates no data available. A return value of SOCKET_ERROR (-1) indicates an error condition. A return value of SOCKET_DISCONNECTED indicates the connection no longer exists.
Remarks
None.