DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

socketpair(SSC)


socketpair -- create a pair of connected sockets

Syntax

cc ... -lsocket

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

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

Description

The socketpair( ) call creates an unnamed pair of connected sockets in the specified address family d (currently only the AF_UNIX family is supported). The type may be specified as either SOCK_STREAM or SOCK_DGRAM. Because there are no protocol families associated with UNIX domain sockets, the only valid value for protocol is zero. The descriptors used in referencing the new sockets are returned in sv[0] and sv[1]. The two sockets are indistinguishable.

Return values

socketpair( ) returns 0 on success. Upon failure, socketpair( ) returns -1 and sets errno to indicate the error.

See also

unix(ADMP)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003