recvfrom()

This is used to receive a message from a connection-mode or connectionless-mode socket. Here it its syntax:

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

Here, we need to address the following:

The function returns the length of the message that's written to the buffer, which is pointed to by the buffer argument.

Now, we can begin with the first part of this recipe: preparing a server to wait for and reply to a message from the client using a UDP socket.