UDT Reference

UDT Reference: Functions

#### getpeername

The getpeername method retrieves the address informtion of the peer side of a connected UDT socket.

int getpeername(
UDTSOCKET u,
struct sockaddr* name,
int* namelen
);

##### Parameters

u
  [in] Descriptor identifying a connected socket.
name
  [out] The structure to store the address of the peer.
addrlen
  [in, out] pointer to the size of the name structure.

##### Return Value

On success, getlasterror returns 0 and the peer address information is stored in name; otherwise it returns UDT::ERROR and the specific error information can be retrieved using getlasterror.

Error Name | Error Code | Comment
ENOCONN | 2002 | u is not connected.
EINVPARAM | 5003 | Invalid parameters.
EINVSOCK | 5004 | u is an invailid UDT socket.

##### Description

The getpeername retrieves the address of the peer side associated to the connection. The UDT socket must be connected at the time when this method is called. The namelen must provide the leangth of the name parameter, which should be enough to hold the address information. On return, namelen contains the length of the result.

##### See Also

listen, connect, accept