Receives data from a socket. The recv() call may be used by both the server and client processes.
Syntax
count= recv(socket, buffer, len, flags)
int count, socket, len; char *buffer;
long flags;
Parameters
count | Returns the number of bytes actually received. | |
| Returns 0 if the remote process has gracefully shut down and | |
| there is no more data in the receive buffer. | |
| Returns | |
socket | Socket descriptor of the local socket receiving data. | |
buffer | Byte pointer to the data buffer. | |
len | Maximum number of bytes that will be returned into the buffer | |
| referenced by buffer. No more than len bytes of data are | |
| received. If there are more than len bytes of data on the | |
| socket, the remaining bytes are received on the next recv(). | |
flags | Optional flag options. The currently supported values for | |
| flags are: |
|
| 0 | No option. |
| MSG_PEEK | Option to preview incoming data. If this |
|
| option is set on the recv() call, any data |
|
| returned remains in the socket buffer as |
though it had not been read yet. The next recv() call returns the same data.
Berkeley Software Distribution Interprocess Communication 49