Networking
The final core IPC mechanism that the operating system provides is networking support through sockets. Sockets are duplexed (bidirectional) communication channels, between two processes. Sockets belong to a particular domain, which determines how its data is routed from one process to another. We’ve already discussed one of these domains—UNIX domain sockets, which allow processes running on the same host system to communicate with each other. The two other domains that are defined by POSIX are the IPv4 and IPv6 internet protocols. Domains are also referred to as address families.
Sockets also support different connection types, which determines how connections are established and terminated, and how data is sent and received on either end. The POSIX socket types were described previously for UNIX domain sockets: stream, datagram, and sequenced packet.
A socket is also associated with a particular protocol, which further affects how connections are established and terminated, and how data is sent and received. Stream sockets are typically associated with TCP, which is a reliable, connection oriented byte-based protocol. Datagram sockets are typically associated with UDP, which is a best effort, connectionless, message-based protocol. Sequenced packet sockets are typically associated with SCTP, which combines the reliability of TCP with the connectionless message-based properties of UDP. However, there may be other protocols that can be associated with a socket of a particular type. For example, stream sockets can also use SCTP, instead of TCP. Compared to sequenced packet sockets which establish a one-to-many relationship, stream sockets using SCTP establish a one-to-one relationship that is connection oriented.