Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)

getpeername(2) OSS System Calls Reference Manual
AF_UNIX Release 1 or
AF_UNIX Release 2 in AF_UNIX Release 2 in
Compatibility Mode Portability Mode
____________________________________________________________
After a successful call to con-
nect() on a stream socket where a
relative pathname is passed in the
address parameter, a subsequent
call to getpeername() returns the
relative path name passed to con-
nect().
After a successful call to con-
nect() on a stream socket where a
relative pathname is passed in the
address parameter, a subsequent
call to getpeername() returns the
fully-qualified equivalent of the
relative path name passed to con-
nect().
After a successful call to con-
nect() on a datagram socket, when
the file specified in the addres s
parameter is renamed, a subse-
quent call to getpeername() fails
with errno set to [ENOENT].
After a successful call to con-
nect() on a datagram socket, when
the file specified in the addres s
parameter is renamed, a subse-
quent call to getpeername()
returns the name of the file at the
time of the connect() call.
After a successful call to con-
nect() on a datagram socket, if the
file specified in the address param-
eter is unlinked, a subsequent call
to getpeername() fails with errno
set to [ENOENT].
After a successful call to con-
nect() on a datagram socket, if the
file specified in the address param-
eter is unlinked, a subsequent call
to getpeername() returns the
fully-qualified name of the file
passed to the connect() call.
For more information about AF_UNIX Release 2 sockets, portability mode, and compatibility
mode, see the Open System Services Programmers Guide.
NOTES
This function requires that the feature-test macro _XOPEN_SOURCE_EXTENDED be specified
when you compile the module.
A process can use the getsockname() function to retrieve the locally bound name of a socket.
On systems running H06.24 or later H-series RVUs or J06.13 or later J-series RVUs, you can use
this function with 32-bit or 64-bit OSS applications.
RETURN VALUES
Upon successful completion, the getpeername() function returns the value 0 (zero). Otherwise,
the value -1 is returned and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the getpeername() function sets errno to the
corresponding value:
[EBADF] The socket parameter is not a valid file descriptor.
[ECONNRESET]
One of the following conditions occurred:
The transport-provider process for this socket is no longer available.
The TCP/IP subsystem for this socket is no longer available.
376 Hewlett-Packard Company 527186-023