Library /sys$common/syshlp/HELPLIB.HLB  —  TCPIP Services, Programming Interfaces, Socket API Functions, getpeername()
    Returns the name of the connected peer.
    The $QIO equivalent is the IO$_SENSEMODE function with the p4
    argument.
    Format
      #include  <types.h>
      #include  <socket.h>
      int getpeername  ( int s, struct sockaddr *name, int *namelen
                       ); (_DECC_V4_SOURCE)
      int getpeername  ( int s, struct sockaddr *name, size_t
                       *namelen ); (not_DECC_V4_SOURCE)

1  –  Arguments

 s
    A socket descriptor created using socket().
 name
    A pointer to a buffer where the peer name is to be returned.
 namelen
    An address of an integer that specifies the size of the name
    buffer. On return, it is modified to reflect the actual length,
    in bytes, of the name returned.

2  –  Description

    This function returns the name of the peer connected to the
    specified socket descriptor.
    Related Functions
    See also bind(), socket(),  and getsockname().

3  –  Return Values

    0                  Successful completion.
    -1                 Error; errno is set to indicate the error.

4  –  Errors

    EBADF              The descriptor is invalid.
    EFAULT             The name argument is not a valid part of the
                       user address space.
    EINVAL             The socket has been shut down.
    ENOBUFS            The system has insufficient resources to
                       complete the call.
    ENOTCONN           The socket is not connected.
    ENOTSOCK           The socket descriptor is invalid.
    EOPNOTSUPP         The operation is not supported for the socket
                       protocol.
Close Help