Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getsockname(2) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bind(2)

socket(2)

getpeername(2)

inet(7F)

GETSOCKNAME(2)  —  Series 300 and 800 Only

NAME

getsockname − get socket address

SYNOPSIS

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

DESCRIPTION

S is a socket descriptor.  Getsockname returns the address of the socket indicated by s. Addr points to a socket address structure in which this address is returned. The addrlen parameter points to an 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 socket, 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 and error code is stored in errno. 

DIAGNOSTICS

The getsockname call fails if:

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

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

[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), getpeername(2), inet(7F). 

Hewlett-Packard Company  —  May 11, 2021

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