Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getpeername(2) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bind(2)

socket(2)

getsockname(2)

inet(7F)

GETPEERNAME(2)  —  Series 300 and 800 Only

NAME

getpeername − get address of connected peer

SYNOPSIS

#include <sys/types.h>
#include <sys/socket.h>
 getpeername(s, addr, addrlen)
int s;
struct sockaddr *addr;
int *addrlen;

DESCRIPTION

S is a socket descriptor.  Getpeername returns the address of the peer socket connected to the socket indicated by s. Addr points to a socket address structure in which this address is returned. The addrlen parameter points to an object of the type int, which should be initialized to indicate the size of the address structure.  On return, it contains the actual size of the address returned (in bytes). If addr does not point to enough space to contain the whole address of the peer, only the first addrlen bytes of the address are returned. 

RETURN VALUE

If the call is successful, 0 is returned. If the call fails, −1 is returned and an error code is stored in errno. 

DIAGNOSTICS

The getpeername call fails if:

[EBADF] The argument s is not a valid file descriptor. 

[ENOTSOCK] The argument 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 addr or addrlen parameters are not valid pointers. 

[EINVAL] The socket has been shut down. 

DEPENDENCIES

Implemented on the Series 300 and 800 only. 

AUTHOR

UCB (University of California at Berkeley)

SEE ALSO

bind(2), socket(2), getsockname(2), inet(7F). 

Hewlett-Packard Company  —  May 11, 2021

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