Sunday, 8 September 2013

Socket bind with wildcard ip

Socket bind with wildcard ip

I have a created a UDP socket and bind that socket to inaddr_any (0.0.0.0)
and and some well known port number. As per my understanding this socket
can receive data over all the interfaces of the machine over the specified
port number. But When i will call send() it will use the default IP
address as the source address.
How is the default IP address chosen?
If I want to use some other interface (other than the default) for sending
the data, how can this be done?
Context of the problem:
I am implementing LDP protocol. It can have many hello adjacencies. Thus i
am creating a server to recv data from the other interfaces of the router.
Once the hello adjacency is formed, then hello messages are to sent be on
the specific interface over UDP over which the hello adjacency is created.

No comments:

Post a Comment