In C++, how can I get the receiver address of the UDP packet which I have received using recvfrom. I know that it should be the same host on which I
On Linux you want to use IP_PKTINFO option, see ip(7), and the recvmsg(2) call.
IP_PKTINFO
Stevens has examples of doing this but with IP_RECVDSTADDR and IP_RECVIF options that are not available on Linux.
IP_RECVDSTADDR
IP_RECVIF