05-23-2002
670,
4
Join Date: Dec 2000
Last Activity: 9 July 2019, 2:02 AM EDT
Location: Phoenix, AZ
Posts: 670
Thanks Given: 0
Thanked 4 Times in 4 Posts
Im not sure clearly what your question is, but i will give a try.
INADDR_ANY has the following semantics, When receiving, a socket bound to the address receives packets from all interfaces. For example, suppose that a host has interfaces 0, 1 and 2. If a UDP socket on this host is bound using INADDR_ANY and udp port 8000, then the socket will receive all packets for port 8000 that arrive on interfaces 0, 1, or 2. If a second socket attempts to Bind to port 8000 on interface 1, the Bind will fail since the first socket already "owned'' that port/interface. When sending, a socket bound with INADDR_ANY binds to the default IP address, which is that of the lowest-numbered interface.