IPSocket.getpeername

Obtains the address of the peer connected to this socket.

  1. int getpeername(InAddr remote_address)
    class IPSocket(bool IPv6 = false)
    int
    getpeername
  2. int getpeername(sockaddr* remote_address, socklen_t addrlen)

Parameters

remote_address InAddr

filled in with the address of the remote socket, as known to the communications layer, depending on the IP version of this class

Return Value

Type: int

0 success or -1 on failure. On failure errno is set appropriately.

Errors: EBADF this.fg is not a valid descriptor.

EFAULT The remote_address argument points to memory not in a valid part of the process address space.

ENOBUFS Insufficient resources were available in the system to perform the operation.

ENOTSOCK this.fd is a file, not a socket.

Meta