Is there a simple, portable way to discover the outgoing IP address of a 
datagram socket on a multi-homed host?

...that is...

I want to send a browser message.  I know the destination address (a host 
address or the local broadcast address).  Once I open the socket I can use 
getsockname(2) to discover the outgoing port number (that is, the source 
port).  The problem is that getsockname(2) returns INADDR_ANY (0.0.0.0), 
which is reasonable since the system doesn't know the outbound interface 
address until the message gets routed.

So, is there any portable way to ask the system which IP address (which 
interface, I suppose) will be used as the source address before sending 
the datagram?

Chris -)-----

-- 
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   [EMAIL PROTECTED]
OnLineBook -- http://ubiqx.org/cifs/    -)-----   [EMAIL PROTECTED]

Reply via email to