Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S

socketpair(2)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

socketpair() — create a pair of connected sockets

SYNOPSIS

#include <sys/socket.h>

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

DESCRIPTION

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.

X/Open Sockets Compilation Environment

See xopen_networking(7).

RETURN VALUE

socketpair() returns the following values:

0

Successful completion.

-1

Failure. errno is set to indicate the error.

ERRORS

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 full.

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

socketpair() is supported only for AF_UNIX.

WARNINGS

Linking binary objects compiled to X/Open Sockets specification and binary objects compiled to HP-UX BSD Sockets specification to the same executable may result in unexpected behavior, including application abnormal termination and unexpected socket errors. See xopen_networking(7) for details and remedy.

FUTURE DIRECTION

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

socketpair() was developed by HP and the University of California, Berkeley.

STANDARDS CONFORMANCE

socketpair(): XPG4, UNIX 95, UNIX 03

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.