BOOL GetSockName( CString& rSocketAddress, UINT& rSocketPort );
BOOL GetSockName( SOCKADDR* lpSockAddr, int* lpSockAddrLen );
Return Value
Nonzero if the function is successful; otherwise 0, and a specific error code can be retrieved by calling GetLastError. The following errors apply to this member function:
Parameters
rSocketAddress
Reference to a CString object that receives a dotted number IP address.
rSocketPort
Reference to a UINT that stores a port.
lpSockAddr
A pointer to a SOCKADDR structure that receives the address of the socket.
lpSockAddrLen
A pointer to the length of the address in lpSockAddr in bytes.
Remarks
Call this member function to get the local name for a socket. This call is especially useful when a Connect call has been made without doing a Bind first; this call provides the only means by which you can determine the local association which has been set by the system. For more information, see Overview of Windows Sockets 2 and Windows Sockets Programming Considerations in the Win32 SDK documentation.
CAsyncSocket Overview | Class Members | Hierarchy Chart
See Also CAsyncSocket::Bind, CAsyncSocket::Create, CAsyncSocket::GetPeerName