You are not logged in.
how to find Client's Destination Address from Server Side?
Assume that server machine has two IP Addresses 192.168.10.156 and 192.168.10.157 listening on Port number 3000
Suppose if any client communicates server on 3000 port with ipaddr 192.168.10.157
How should the server make sure that the client now contacts me in 192.168.10.157:3000 over UDP protocol(Datagram Programming)?
Is Any Method is there to find the client's destination IP address and Port number?
Please reply anyone who knows the solution,
Thanking you all,
With TCP it's easy: just use getsockname() on the newly accept()'d socket... But,
with UDP, it's more difficult... The usual kluge method taken is to simply use
multiple sockets, one bound to each local IP, rather than a single socket bound
to INADDR_ANY... That way, you can always tell which IP a client is coming in
through based on which socket the message comes from... But, many systems
also have other methods you can use; usually sockopts like IP_PKTINFO,
IP_RCVDSTADDR, IP_RECVIF, etc... It depends on what system you're on...