socketpair()

create unbound pair of sockets 

Function


SYNOPSIS

#include <sys/types.h>

#include <sys/socket.h>

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


DESCRIPTION

The socketpair() system call creates an unbound pair of connected sockets, and returns a pair of descriptors. The sockets are identical and have the indicated type, which defines the semantics of communication. Currently, there are five defined types.

The NuTCRACKER Platform socket support is based on WinSock 2.0.


PARAMETERS

af 

Specifies the address family to be used with the socket.

type 

Specifies the socket type which defines the semantics of communication.

protocol 

Specifies the appropriate protocol for the address family and socket type. It is indicated by a well known constant specific to each address family. The default protocol (protocol parameter to the socketpair() call is 0) should be correct for most situations.

sv 

Specifies a 2-integer array into which the two descriptors for the newly created sockets are written.


RETURN VALUES

If successful, socketpair() returns 0. If an error occurs, it returns a value of -1 and sets errno to one of the following values:

EAFNOSUPPORT 

The specified address family is not supported.

EMFILE 

No more socket descriptors can be created.

ENETDOWN 

The network subsystem has failed.

ENOBUFS 

No buffer space is available. The socket cannot be created.

EPROTONOSUPPORT 

The specified protocol is not supported.

EPROTOTYPE 

The socket type is not supported by the protocol.

ESOCKTNOSUPPORT 

The specified socket type is not supported in this address family.


CONFORMANCE

UNIX 98, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

socketpair() is only supported for the AF_UNIX address family.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
getsockname(), getsockopt(), recv(), select(), send(), shutdown(), socket()


PTC MKS Toolkit 10.4 Documentation Build 39.