*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> getpeername (2)              
Title
Content
Arch
Section
 

Contents


 getpeername(2)                                               getpeername(2)




 NAME    [Toc]    [Back]
      getpeername - get address of connected peer

 SYNOPSIS    [Toc]    [Back]
      #include <sys/socket.h>

    AF_CCITT only:
      #include <x25/x25addrstr.h>

      int getpeername(int s, void *addr, int *addrlen);

    _XOPEN_SOURCE_EXTENDED only (UNIX 98)
      int getpeername(int s, struct sockaddr *addr, socklen_t *addrlen);

    Obsolescent _XOPEN_SOURCE_EXTENDED only (UNIX 95)    [Toc]    [Back]
      int getpeername(int s, struct sockaddr *addr, size_t *addrlen);

 DESCRIPTION    [Toc]    [Back]
      getpeername() returns the address of the peer socket connected to the
      socket indicated by s, where s is a socket descriptor.  addr points to
      a socket address structure in which this address is returned.  addrlen
      points to a variable that should be initialized to indicate the size
      of the address structure.  On return, the variable 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 peer, only the first
      addrlen bytes of the address are returned.

    AF_CCITT only:
      The addr struct contains the X.25 addressing information of the remote
      peer socket connected to socket s.  However, the x25ifname[] field of
      the addr struct contains the name of the local X.25 interface through
      which the call arrived.

 RETURN VALUE    [Toc]    [Back]
      Upon successful completion, getpeername() returns 0; otherwise it
      returns -1 and sets errno to indicate the error.

 ERRORS    [Toc]    [Back]
      getpeername() fails if any of the following conditions are
      encountered:

           [EBADF]             s is not a valid file descriptor.

           [ENOTSOCK]          s is a valid file descriptor, but it is not a
                               socket.

           [ENOTCONN]          The socket is not connected.

           [ENOBUFS]           No buffer space is available to perform the
                               operation.




 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 getpeername(2)                                               getpeername(2)




           [EFAULT]            addr or addrlen are not valid pointers.

           [EINVAL]            The socket has been shut down.

 OBSOLESCENCE    [Toc]    [Back]
      Currently, the socklen_t and size_t types are the same size.  This is
      compatible with both the UNIX 95 and UNIX 98 profiles.  However, in a
      future release, socklen_t might be a different size.  In that case,
      passing a size_t pointer will evoke compile-time warnings, which must
      be corrected in order for the application to behave correctly.
      Applications that use socklen_t now, where appropriate, will avoid
      such migration problems.  On the other hand, applications that need to
      be portable to the UNIX 95 profile should follow the X/Open
      specification (see xopen_networking(7)).

 FUTURE DIRECTION    [Toc]    [Back]
      Currently, the default behavior is the HP-UX BSD Sockets; however, it
      might be changed to X/Open Sockets in a future release.  At that time,
      any HP-UX BSD Sockets behavior that is incompatible with X/Open
      Sockets might be obsoleted.  Applications that conform to the X/Open
      specification now will avoid migration problems (see
      xopen_networking(7)).

 AUTHOR    [Toc]    [Back]
      getpeername() was developed by HP and the University of California,
      Berkeley.

 SEE ALSO    [Toc]    [Back]
      bind(2), socket(2), getsockname(2), thread_safety(5), inet(7F),
      xopen_networking(7).


 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
getpeername NetBSD get name of connected peer
getpeername Linux get name of connected peer
getpeername OpenBSD get name of connected peer
getpeername IRIX get name of connected peer
getpeername FreeBSD get name of connected peer
getpeername IRIX get name of connected peer
datapipe IRIX peer-to-peer data transfer between hardware devices.
VkForkWindow IRIX Window connected to a subprocess via VkForkIO
usbdevs FreeBSD show USB devices connected to the system
socketpair Tru64 Create a pair of connected sockets
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service