> >A more acurate way for an application to obtain the IP address of its
> >host to use the getsockname() function which opens a socket to a remote
> >host and then returns the IP address through the open connection.
No, unless this is a non-unix getsockname function. The getsockname I know
just gets the IP address of the local end. You have to issue other system
calls to create the socket and initiate a connection. I don't know how far
along the connection process you have to be before you can issue the
getsockname.
CLIENT SERVER
socket socket
(optional) bind bind
(getsockname permissible here?)
connect listen
accept
That is pretty clever though. I never thought of using getsockname to find
a local IP address.