|
|
This section describes the socket(SSC) system call and the three most commonly used socket types.
A socket is the basic building block for communication, providing an endpoint to which a name may be bound. Sockets function either as clients or servers. A server typically advertises some service at a well-known address and waits for clients to request connections. Clients requiring a particular service attempt to connect to a server at the server's advertised transport address.
Sockets are created within a communications domain much
as files are created within a filesystem.
A socket is created with a call to the socket
system call of the form:
s = socket (domain, type, protocol)
The call returns a socket descriptor that is used in
system calls operating on the socket.
The domain parameter, also called ``family'',
refers to the protocol family within which communication
takes place. The currently supported formats are
AF_UNIX (address family UNIX domain) and AF_INET
(address family Internet).
The socket type is one of: