getpeername(2dn)
NAME
getpeername − get name of connected peer
SYNTAX
# include <system/types.h>
# include <sys/socket.h>
# include <netdnet/dn.h> getpeername (s,name,namelen)
int s;
struct sockaddr_dn *name;
int *namelen;
ARGUMENTS
Input Arguments
s Specifies a descriptor for a socket that has been returned by the socket or the accept call.
name Specifies the address of a structure of the type sockaddr_dn. This address identifies the connected peer socket.
namelen Specifies the length of the address of the structure sockaddr_dn.
Return Arguments
name Specifies the address of a structure of the type sockaddr_dn. The following data fields are filled in by this call:
sdn_family Specifies the communications domain as AF_DECnet.
sdn_objnum Specifies the DECnet object number for the peer program. If the object number is 0, the DECnet object name, sdn_objname, is used.
sdn_objnamel Size of the peer object name. This argument is used only when the object number, sdn_objnum, is 0.
sdn_objname Specifies the name of the peer network program, which can be up to a 16-element array of characters. This argument is used only when the object number, sdn_objnum, is 0.
sdn_nodeaddrl Size of the remote node address.
sdn_nodeaddr Specifies the remote node address.
namelen Returns the length of the address of the structure sockaddr_dn.
DESCRIPTION
The getpeername call returns the name of the peer DECnet program connected to a specified socket.
RETURN VALUE
If the call succeeds, a value of 0 is returned. If an error occurs, a value of -1 is returned. When an error condition exists, the external variable errno contains error detail.
DIAGNOSTICS
[EBADF] The s argument is not a valid descriptor.
[ENOTCONN]
The socket s is not connected.
[ENOBUFS]
Insufficient resources were available in the system to perform the operation.
[EFAULT] The name argument points to memory located in an invalid part of the process address space.