Respected people,
I am Sreeram. I work on TCP/IP network applications.
This mail is regarding UDP.
Whenever a UDP datagram arrives, the receiver may wish to know the
sender's IP address and also the destination address of that datagram.
The recvfrom() function will return the sender's IP address. If the
destination address of the datagram is required, then the user has to
set the IP_PKTINFO socket option for the UDP socket and get the
address as ancillary data in recvmsg(). So, the point here is that the
user has to issue 2 reads on the same datagram (with the flag MSG_PEEK
in first read call enabled) in order to obtain the sender's IP and the
destination IP of the datagram.