InetGetLocalAddress
INT InetGetLocalAddress(
SOCKET hSocket,  
DWORD* lpdwAddress,  
UINT* lpnPort  
);

The InetGetLocalAddress function returns the local IP address and port number for the specified socket.

Parameters

hSocket
The socket handle.
lpdwAddress
A pointer to an unsigned long integer that will contain the local IP address. If the hSocket parameter specifies a valid socket, this parameter will be set to the address that the socket was bound to. If the hSocket parameter is set to INVALID_SOCKET, the function will attempt to determine the default IP address for the local host.
lpnPort
A pointer to an unsigned integer that will contain the local port number. If the hSocket parameter specifies a valid socket, this parameter will be set to the local port that the socket was bound to. If the hSocket parameter is set to INVALID_SOCKET, this parameter is ignored.

Return Value

If the function succeeds, the return value is zero. If the function fails, the return value is INET_ERROR. To get extended error information, call InetGetLastError.

Requirements

Client: Requires Windows Vista, Windows XP or Windows 2000 Professional.
Server: Requires Windows Server 2008, Windows Server 2003 or Windows 2000 Server.
Header: Include cswsock6.h.
Library: Use cswskav6.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

InetGetExternalAddress, InetGetHostAddress, InetGetHostName, InetGetLocalName, InetGetPeerAddress


Copyright © 2008 Catalyst Development Corporation. All rights reserved.