*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: socket | Section: 2 | Source: Digital UNIX | File: socket.2.gz
socket(2) System Calls Manual socket(2) NAME socket - Creates an end point for communication and returns a descrip- tor SYNOPSIS #include <sys/socket.h> int socket ( int domain, int type, int protocol ); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: socket(): XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Specifies the communications domain in which a socket is to be created. The domain argument specifies the address family with which addresses specified in later socket operations should be interpreted. The sys/socket.h file contains the definitions of the address families. Commonly used families are: UNIX pathnames ARPA Internet addresses Specifies the semantics of communication. The sys/socket.h file defines the socket types. The following types are supported: Provides se- quenced, reliable, two-way byte streams with a transmission mechanism for out-of-band data. Provides datagrams, which are connectionless messages of a fixed maximum length. [Digital] Provides access to in- ternal network protocols and interfaces. This type of socket is avail- able only to a process with superuser privilege. Specifies a particu- lar protocol to be used with the socket. Specifying a protocol of 0 (zero) causes the socket() function to default to the typical protocol for the requested type of returned socket. DESCRIPTION The socket() function creates a socket of the specified type in the specified domain. The socket() function returns a descriptor (an integer) that can be used in later system calls that operate on sockets. Socket level options control socket operations. The getsockopt() and setsockopt() functions are used to get and set these options, which are defined in the sys/socket.h file. RETURN VALUES Upon successful completion, the socket() function returns a nonnegative integer (the socket descriptor). Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS If the socket() function fails, errno may be set to one of the follow- ing values: The process have not have appropriate privileges. The ad- dresses in the specified address family are not available in the ker- nel. The per-process descriptor table is full. No more file descrip- tors are available for the system. Insufficient resources were avail- able in the system to complete the call. The system was unable to al- locate kernel memory to increase the process descriptor table. The process is attempting to open a raw socket and does not have superuser privilege. The socket in the specified address family is not sup- ported. The socket type is not supported by the protocol. RELATED INFORMATION Functions: accept(2), bind(2), connect(2), listen(2), getsockname(2), getsockopt(2), recv(2), recvfrom(2), recvmsg(2), send(2), sendto(2), sendmsg(2), setsockopt(2), shutdown(2), socketpair(2) Standards: standards(5) delim off socket(2)

Navigation Options