AlgoMaster Logo

Unix Domain Sockets

Medium Priority19 min readUpdated August 14, 2026

When two processes on the same machine need reliable two-way communication, a Unix domain socket is often a better fit than TCP.

For example, a reverse proxy and an application server may need full-duplex communication and a stable endpoint, but they do not need network routing.

A Unix domain socket provides the familiar socket API entirely within one host. The server binds to a local path, clients connect to it, and both sides exchange data through file descriptors.

It also supports useful local features such as retrieving peer credentials and passing open file descriptors between processes.

This makes Unix domain sockets common for databases, local proxies, service supervisors, container runtimes, and communication between privileged and unprivileged processes.

This chapter develops the Unix domain socket lifecycle and socket types, explains framing, partial I/O, endpoint lifetime, and backpressure, and shows how local processes verify peers and pass file descriptors.

Premium Content

Subscribe to unlock full access to this content and more premium articles.