nlGetLocalAddr, nlSetLocalAddr

get the local address of a socket, or set the default address for new sockets

C Specification

NLboolean nlGetLocalAddr(NLsocket socket, NLaddress *address)

NLboolean nlSetLocalAddr(const NLaddress *address)



[in]Specifies a socket.


[out]Specifies a pointer to the address allocated by the caller.


nlGetLocalAddr finds the local address for socket. This is usually the default NIC IP address. On a multihomed system (more than one NIC on separate networks), if the socket is connected, then address will correspond to the IP address of the NIC that is connected to the remote address. If nlGetLocalAddr was successful address.valid will be set to NL_TRUE, otherwise it will be set to NL_FALSE.

nlSetLocalAddr sets the default local address. It effects all sockets created AFTER this call.

Return values

NL_TRUE if no error occurs, otherwise NL_FALSE, and the specific error code can be retrieved by calling nlGetError

Error codes

NL_INVALID_SOCKET : The socket is not valid.
NL_NULL_POINTER : A NULL pointer was passed to this function.
NL_SYSTEM_ERROR : A system Socket error has ocurred. The system error can be retrieved by calling nlGetSystemError.

See also


Back to the HawkNL index page

Go directly to the main HawkNL page at Hawk Software

© 2000-2002 Phil Frisbie.

Valid XHTML 1.0!