[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Portable way to get my NICs' IPs



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephen R Laniel wrote:

> I open a socket to a remote machine, and that socket binds to a
> particular interface, right? How does the socket decide what to
> bind to? Presumably the socket libraries are fairly portable,
> right?

- From a socket-using program's point of view you just choose an IP
(which afaik you have to find out yourself) to bind to, or let the OS
choose one for you by not specifying (or with IN_ADDR_ANY or
something...). You don't really deal with a list of IPs or interfaces
(at least, I never have...), you just call socket(), bind() and
connect() without ever knowing which IPs are on which interfaces or
anything like that.

hth

- -ol

- --
I will live forever, or die trying.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDYp8oOq/GuNpXGggRAoMlAJ4rloWTzbEAe+EtVIM+E/mbYxeE7QCg5aqO
1OItGGCuK1phzckHv3TYE4E=
=OdtS
-----END PGP SIGNATURE-----



Reply to: