Copyright (c) 1983, 1991, 1993 The Regents of the University of California. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the fol...
NAMEsocketpair - create a pair of connected sockets
SYNOPSISIn sys/types.h In sys/socket.h Ft int Fn socketpair int domain int type int protocol int *sv
DESCRIPTIONThe Fn socketpair system call creates an unnamed pair of connected sockets in the specified communications Fa domain , of the specified Fa type , and using the optionally specified Fa protocol . The descriptors used in referencing the new sockets are returned in Fa sv Ns  and Fa sv Ns  . The two sockets are indistinguishable.
The SOCK_CLOEXEC and SOCK_NONBLOCK flags in the Fa type argument apply to both descriptors.
RETURN VALUESRv -std socketpair
ERRORSThe call succeeds unless:
- Bq Er EMFILE
- Too many descriptors are in use by this process.
- Bq Er EAFNOSUPPORT
- The specified address family is not supported on this machine.
- Bq Er EPROTONOSUPPORT
- The specified protocol is not supported on this machine.
- Bq Er EOPNOTSUPP
- The specified protocol does not support creation of socket pairs.
- Bq Er EFAULT
- The address Fa sv does not specify a valid part of the process address space.