Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getpeername(2) — Ultrix-11 3.0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bind(2)

getsockname(2)

socket(2)

getpeername(2)

NAME

getpeername − get name of connected peer

SYNTAX

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

DESCRIPTION

The getpeername system call returns the name of the peer connected to socket s. The specified namelen should be initialized to indicate the amount of space pointed to by name.  On return, it contains the actual size of the name returned (in bytes). 

RESTRICTIONS

Names bound to sockets in the UNIX domain are inaccessible.  The getpeername call returns a zero length name. 

RETURN VALUE

If unsuccessful, returns a −1, and the global variable errno indicates the error code. 

DIAGNOSTICS

The getpeername call will fail if:

[EBADF] The specified s is not a valid descriptor. 

[ENOTSOCK] The specified s is a file, not a socket. 

[ENOTCONN] The socket is not connected. 

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

[EFAULT] The specified name points to memory that is not in a valid part of the process address space. 

SEE ALSO

bind(2), getsockname(2), socket(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026