Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ socketpair(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

socketpair

Purpose

     Creates a pair of connected sockets.

Syntax

     #include <sys/types.h>
     #include <sys/socket.h>

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

Description

     The socketpair subroutine creates an unnamed pair of con-
     nected sockets in  the specified domain d,  of the speci-
     fied type,  and using the optionally  specified protocol.
     The descriptors  used in referencing the  new sockets are
     returned in  sv[0] and sv[1].  The two sockets  are iden-
     tical.

     Note:  The socketpair subroutine can  be used only in the
     local (AF_UNIX) domain.  This  subroutine does not create
     sockets for use in the Internet domain.

Return Value

     Upon successful completion, a value of 0 is returned.  If
     the  socketpair  subroutine  fails,  a  value  of  -1  is
     returned, and errno is set to indicate the error.

Diagnostics

     The subroutine fails if one  or more of the following are
     true:

     EMFILE            This process  has too  many descriptors
                       in use.

     EAFNOSUPPORT      The addresses in  the specified address
                       family cannot be used with this socket.

     EPROTONOSUPPORT   The specified  protocol cannot  be used
                       on this system.

     EOPNOSUPPORT      The specified  protocol does  not allow
                       create of socket pairs.

     EFAULT            The sv  parameter is not in  a writable
                       part of the user address space.

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026