DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Interprocess communication using UNIX domain sockets

Creating a socket (UNIX domain)

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:


SOCK_DGRAM
provides unreliable, connectionless transmission in individually addressed datagrams.

SOCK_STREAM
the most commonly used type, provides reliable, full-duplex, connection-oriented transmission in which data flows through the socket as a stream of characters.
protocol must be set to 0 for UNIX domain sockets.
Next topic: Address structures (UNIX domain)
Previous topic: Socket Tutorial (UNIX domain)

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