You are here : cpp0recv

recv() - 0

recv - receive a message from a connected socket.
The recv() function receives a message from a connection-mode or connectionless-mode socket. It is normally used with connected sockets because it does not permit the application to retrieve the source address of received data.


Syntax

#include <sys/socket.h>

ssize_t recv(int socket, void *buffer, size_t length, int flags);


Example


Output / Return Value

Upon successful completion, recv() returns the length of the message in bytes. If no messages are available to be received and the peer has performed an orderly shutdown, recv() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.


Limitations


Alternatives / See Also


Reference