You are here : Csys/socket.hrecv

recv() - sys/socket.h

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.


#include <sys/socket.h>

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


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.


Alternatives / See Also