Why getsockname will not work with udp sockets ?
Posted on 2005-03-22
I want to get my local ethernet ip on which i receive a socket data. I have eth0: 10.0.0.100 and eth1:192.168.1.100 then how to know on which i receive socket data. I know that i only sending data from another pc eth:10.0.0.200 to 10.0.0.100. But how can i get that info in my udpServer.
I must have to set server socket with
servAddr.sin_family = AF_INET;
servAddr.sin_addr.s_addr = htonl(INADDR_ANY);
servAddr.sin_port = htons(LOCAL_SERVER_PORT);
then how t get my local IP?
I already use successfully getsockname with TCP sockets with no problem.
I am USING RH LINUX OS.