getpeername

getpeername fills in the address of the peer connected to a socket.

Syntax

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

Parameters

s

Socket descriptor

name

Pointer to a socket address structure that receives the address of the peer.

namelen

Pointer to an integer that defines the size of the socket address structure indicated by name. Upon return, namelen shall contain the actual size in bytes of name.

Return Values

0 (zero) if the function succeeds, SOCKET_ERROR if the function fails

Use WSAGetLastError to retrieve a specific error code.

IntervalZero.com | Support | Give Feedback