UDT Reference: UDT Functions

getpeername

The getpeername function retrieves the name of the peer to which a socket is connected.

int getpeername(
  UDTSOCKET u,

  struct sockaddr *name,
  int *namelen

);

Parameters

u
[in] Descriptor identifying a connected socket.
name
[out] The structure that receives the name of the peer.
namelen
[in, out] Pointer to the size of the name structure.

Return Values

On success, 0 is returned. Otherwise, UDT::ERROR is returned and the specific error information can be retrieved by getlasterror.

Error Code Comment

2002

u is not connected.

5003

invalid parameters.

5004

u is an invalid UDT socket.

Description

The getpeername method retrieves the address of the peer side. The UDT socket must be connected at the time getpeername is called.

See Also

bind, connect