BSD Sockets Interface Programmer's Guide

Chapter 4 99
Using Internet Datagram Sockets
Sending and Receiving Messages
MSG_PEEK for a nondestructive read.
Use the MSG_PEEK option to preview an incoming message. If this
option is set on a recvfrom, any message returned remains in the data
buffer as though it had not been read yet. The next recvfrom will return
the same message.
When to Receive Data
The client or server process should receive data after sockets are bound.
Refer to the recv(2) man page for more information on recvfrom and
recvmsg.