You are here : Csys/socket.hrecvfrom

recvfrom() - sys/socket.h

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


#include <sys/socket.h>

ssize_t recvfrom(int socket, void *buffer, size_t length, int flags,
             struct sockaddr *address, socklen_t *address_len);


Output / Return Value

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


Alternatives / See Also