getsockname
The getsockname function retrieves the local name for a socket.
int getsockname(
SOCKET s,
struct sockaddr* name,
int* namelen
);
Parameters
s
[in] Descriptor identifying a socket.
name
[out] Pointer to a SOCKADDR structure that receives the address (name) of the socket.
namelen
[in, out] Size of the name buffer, in bytes.
-----------------------
getpeername
The getpeername function retrieves the name of the peer to which a socket is connected.
int getpeername(
SOCKET s,
struct sockaddr* name,
int* namelen
);
Parameters
s
[in] Descriptor identifying a connected socket.
name
[out] The SOCKADDR structure that receives the name of the peer.
namelen
[in, out] Pointer to the size of the name structure, in bytes.