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 thesender's IP address and also the destination address of that datagram.The recvfrom() function will return the sender's IP address. If thedestination address of the datagram is required, then the user has toset the IP_PKTINFO socket option for the UDP socket and get theaddress as ancillary data in recvmsg(). So, the point here is that theuser has to issue 2 reads on the same datagram (with the flag MSG_PEEKin first read call enabled) in order to obtain the sender's IP and thedestination IP of the datagram. I personally feel that there should bea way provided to the user to obtain these values in a single readcall. By doing this I am sure that lot of time would be saved incollecting the required information. I have written a simple UDP client program to show that we need 2reads to obtain the above information. I have made it signal-drivenjust to make it interesting and not for any other reason. I haveattached the client program along with this mail. Fortunately, as mentioned above, Linux provides the IP_PKTINFOsocket option, enabling which, will send in a structure 'structin_pktinfo' as ancillary data in recvmsg(). The structure is asfollows:

struct in_pktinfo { unsigned int ipi_ifindex; /* Interface index */ struct in_addr ipi_spec_dst; /* Local address */ struct in_addr ipi_addr; /* Header Destination address */ }; Would it be incorrect if I request the kernel coders to add thesender's IP address as well in this structure, so that the user willget both the sender's IP and the destination IP address of thedatagram in a single call to recvmsg()? I very well understand that my knowledge is very much diminished.Hence I request you to kindly correct me if what I haveunderstood/suggested is incorrect.Please suggest.

Regards,Sreeram/* This is an UDP server which deals with the clients upon receiving a SIGIO signal. The signal is generated whenever a datagram arrives. For this kind of client handling, three steps have to be done: 1. Establish signal handler for SIGIO 2. Set the owner for receiving SIGIO using fcntl() 3. Set the O_ASYNC flag for socket using fcntl() or use ioctl()*/