Sockets provide the user with a means of interprocess communication whereby the processes involved can reside on different hosts across a network. The most common socket types are stream sockets, which provide a logical connection between processes and support the reliable exchange of data, and datagram sockets, which are connectionless and may be unreliable. The actual encoding of data and its transport are further dependent upon the selection of a specific transport protocol.

A series of socket system calls are used to establish socket-based communications. The socket system call is used to create a socket of a specific type using a particular protocol. The bind system call establishes a relationship between the socket and a system address. In a stream-based setting (connection-oriented), the serving process then creates a queue for incoming connections using the listen system call. When a connection from a client process is made, the server then uses the accept system call to generate a new socket, which will be used for actual communications. The connection-oriented client process creates its own socket and uses the connect system call to initiate a connection with the server process. Once a connection is established, the processes involved can use read - write system calls or specialized network send/receive calls to exchange data.

If the communication is datagram-based (connectionless), both the client and server processes generate a socket and bind it. Communication is carried out using a connect - write / accept - read sequence or with specialized send/receive network calls. In a connectionless setting, addressing specifics are incorporated within the message.

The select system call can be used to multiplex socket-based communications. In a stream-based setting a process can peek at arriving data without consuming it and can be notified of a pending urgent message.

Programs and Processes

Processing Environment

Using Processes

Primitive Communications


Message Queues


Shared Memory

Remote Procedure Calls



Appendix A. Using Linux Manual Pages

Appendix B. UNIX Error Messages

Appendix C. RPC Syntax Diagrams

Appendix D. Profiling Programs

Interprocess Communication in Linux
Interprocess Communications in Linux: The Nooks and Crannies
ISBN: 0130460427
EAN: 2147483647
Year: 2001
Pages: 136 © 2008-2020.
If you may any questions please contact us: