Microsoft Windows CE 3.0  

getpeername

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function gets the peer address to which a socket is connected.

int
getpeername(
SOCKET
s
,
struct
sockaddr
*
name
,
int
*
namelen
);

Parameters

s
[in] Descriptor that identifies a connected socket.
name
[out] Structure that receives the peer name.
namelen
[in/out] Pointer to the namestructure size.

Return Values

Zero indicates no error occurred. SOCKET_ERROR indicates failure. To get a specific error value, call WSAGetLastError.

Remarks

The getpeernamefunction retrieves the peer name connected to the socket sand stores it in the a SOCKADDRstructure identified by name. The getpeernamefunction can be used only on a connected socket. For datagram sockets, only the name of a peer specified in a previous connectcall will be returned-any name specified by a previous sendtocall will not be returned by getpeername.

On call, the namelenargument contains the namebuffer size, in bytes. On return, the namelenparameter contains the actual size, in bytes, of the name returned.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winsock.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

bind, getsockname, socket