You are here : cpp0recvfrom

recvfrom() - 0

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.


Syntax

#include <sys/socket.h>

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


Example


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.


Limitations


Alternatives / See Also


Reference