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

  man pages->HP-UX 11i man pages -> socketpair (2)              


 socketpair(2)                                                 socketpair(2)

 NAME    [Toc]    [Back]
      socketpair() - create a pair of connected sockets

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

      int socketpair(int af, int type, int protocol, int sv[2]);

 DESCRIPTION    [Toc]    [Back]
      The socketpair() system call creates an unnamed pair of connected
      sockets and returns two file descriptors in sv[0] and sv[1].  The two
      sockets are indistinguishable.  af specifies the address family.  See
      socket(2).  type specifies the semantics of communication for the
      socket.  protocol specifies a particular protocol to be used.
      protocol can be specified as zero, which causes the system to choose a
      protocol type to use.

 RETURN VALUE    [Toc]    [Back]
      socketpair() returns the following values:

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

 ERRORS    [Toc]    [Back]
      If socketpair() fails, errno is set to one of the following values.

           [EAFNOSUPPORT]      The specified address family is not supported
                               in this version of the system.

           [EFAULT]            The sv parameter is not valid.

           [EMFILE]            The per-process file descriptor table is

           [ENFILE]            The system file table is temporarily full.

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

           [EOPNOTSUPP]        The specified protocol does not support
                               creation of socket pairs.

           [EPROTONOSUPPORT]   The specified protocol is not supported in
                               this version of the system.

 DEPENDENCIES    [Toc]    [Back]
      socketpair() is supported only for AF_UNIX.

 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,

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

 socketpair(2)                                                 socketpair(2)

      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

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

 SEE ALSO    [Toc]    [Back]
      read(2), socket(2), write(2), thread_safety(5), xopen_networking(7).

      socketpair(): XPG4

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
recv Tru64 Receive messages from connected sockets
BIO_new_bio_pair NetBSD create a new BIO pair
BIO_new_bio_pair Tru64 Create a new BIO pair
pipe FreeBSD create descriptor pair for interprocess communication
pipe NetBSD create descriptor pair for interprocess communication
pipe OpenBSD create descriptor pair for interprocess communication
newkey HP-UX create a new Diffie-Hellman key pair in the publickey database
getpeername OpenBSD get name of connected peer
getpeername FreeBSD get name of connected peer
getpeername Linux get name of connected peer
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service