getpeername (2)
Leading comments
Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the fol...
NAME
getpeername - get name of connected peerLIBRARY
Lb libcSYNOPSIS
In sys/types.h In sys/socket.h Ft int Fn getpeername int s struct sockaddr * restrict name socklen_t * restrict namelenDESCRIPTION
The Fn getpeername system call returns the name of the peer connected to socket Fa s . The Fa namelen argument should be initialized to indicate the amount of space pointed to by Fa name . On return it contains the actual size of the name returned (in bytes). The name is truncated if the buffer provided is too small.RETURN VALUES
Rv -std getpeernameERRORS
The call succeeds unless:- Bq Er EBADF
- The argument Fa s is not a valid descriptor.
- Bq Er ECONNRESET
- The connection has been reset by the peer.
- Bq Er EINVAL
- The value of the Fa namelen argument is not valid.
- Bq Er ENOTSOCK
- The argument Fa s is a file, not a socket.
- Bq Er ENOTCONN
- The socket is not connected.
- Bq Er ENOBUFS
- Insufficient resources were available in the system to perform the operation.
- Bq Er EFAULT
- The Fa name argument points to memory not in a valid part of the process address space.