Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

What Is a Unix Domain Socket? Local IPC Explained

A Unix domain socket is a local IPC endpoint. Learn how its socket types, pathname and abstract addresses, and ancillary data shape its use.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Unix domain socket is an endpoint that lets processes on the same machine communicate through the socket API. It uses the AF_UNIX address family, also called AF_LOCAL on Linux; unlike AF_INET and AF_INET6, it is not an Internet address family.

How does a Unix domain socket work?

Processes exchange data by communicating through socket endpoints addressed locally rather than through an IP address. The Linux unix(7) manual describes the family as a way for processes on the same machine to communicate. A Unix domain socket is therefore an IPC mechanism, not a way to connect directly to a remote machine.

As an Amazon Associate I earn from qualifying purchases.

The socket API offers different communication types. The type determines whether the application works with a byte stream or messages, and whether communication is connection-oriented.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Socket type Communication behavior What the application should account for
SOCK_STREAM Connection-oriented byte stream There are no built-in message boundaries, so the application must define framing if it needs to separate messages.
SOCK_DGRAM Datagrams preserve message boundaries. The Linux manual describes Unix-domain datagrams as reliable and unordered in its documented context; do not assume identical guarantees on every operating system.
SOCK_SEQPACKET Connection-oriented communication that preserves message boundaries and delivers messages in order. Check support on the target operating system. The Linux manual says Linux has supported this type since Linux 2.6.4.

These types suit different communication contracts: a continuous stream of bytes, independent messages, or ordered messages over a connection. For platform-specific behavior, consult the target system’s documentation as well as Linux’s unix(7) and socket(2) manuals.

What address does a Unix domain socket use?

Unix domain socket addresses can be unnamed or named. On Linux, a named address can use a filesystem pathname or the abstract namespace.

Filesystem pathname

A pathname socket appears as a socket entry in the filesystem. Linux documents that the caller must remove the entry when it is no longer needed. Filesystem operations can manage its ownership and permissions, making the pathname and the surrounding filesystem permissions relevant to access control.

Rank #2
Sale
The Unix Programming Environment (Prentice-Hall Software Series)
  • The Unix Programming Environment (Prentice-Hall Software Series)
  • Product Type: ABIS_BOOK
  • Pearson

Linux abstract namespace

An abstract address starts with a null byte in sun_path and is independent of filesystem pathnames. It is a Linux-specific, nonportable extension. It has no filesystem permission controls, so a design using it cannot rely on pathname ownership or permissions in the same way. For portable code, use the pathname form where supported and check each platform’s sockaddr_un layout and address-length rules.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can Unix domain sockets pass file descriptors or credentials?

Yes. Unix domain sockets can carry ancillary data, including file descriptors and process credentials. Passing an open file descriptor can let one process hand another access to an already-open resource without communicating through an Internet socket. Credential transfer may also be useful in local service designs, but neither capability is a universal authentication guarantee: the available APIs and rules depend on the operating system and socket type. The Linux unix(7) manual documents these ancillary-data capabilities.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When should you choose a Unix domain socket?

Consider the requirements of the processes and their communication contract rather than assuming one IPC mechanism is always best. A Unix domain socket is a candidate when both endpoints run on one machine and socket-style communication, message handling, or ancillary data fits the design.

  • Locality: If endpoints must communicate across machines, a local address family is not sufficient; choose a network-capable mechanism.
  • Framing: For SOCK_STREAM, define how the receiver identifies message boundaries. Datagram and sequenced-packet types preserve boundaries, with ordering and connection behavior differing by type.
  • Address portability: A filesystem pathname is generally the more portable Unix-domain form; Linux abstract addresses are not portable.
  • Access control: A pathname can use filesystem ownership and permissions. Abstract sockets lack those filesystem controls, so plan access control accordingly.
  • Descriptor passing: If one process needs to transfer an open file descriptor to another, check whether the target platform’s socket APIs support the required ancillary data.

These properties distinguish Unix domain sockets from alternatives such as TCP loopback or pipes, but they do not establish a blanket speed advantage. Choose based on locality, framing, ordering, portability, authorization, and descriptor-passing needs.

Quick Recap

SaleBestseller No. 2
The Unix Programming Environment (Prentice-Hall Software Series)
The Unix Programming Environment (Prentice-Hall Software Series)
The Unix Programming Environment (Prentice-Hall Software Series); Product Type: ABIS_BOOK; Pearson
$70.65
SaleBestseller No. 3
SaleBestseller No. 4

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.