$linuxjunkies
>

socket

also: network socket, Unix socket, domain socket, TCP socket, UDP socket

A socket is an endpoint for network communication or inter-process communication (IPC) that allows two programs to send and receive data. It abstracts the underlying protocol complexity and provides a file-like interface for data exchange.

A socket is a fundamental abstraction in Unix/Linux that represents one end of a communication channel. It can be used for network communication (TCP/IP, UDP) or local inter-process communication (Unix domain sockets). Each socket is associated with a protocol family and type that determines how it behaves.

Network sockets are identified by an IP address, port number, and protocol (TCP or UDP). For example, a web server listens on socket 0.0.0.0:80 to accept incoming HTTP connections. A client connects to a remote socket like 192.168.1.100:80 to establish communication.

Unix domain sockets provide fast, local IPC between processes on the same machine, often appearing as special files in the filesystem (like /run/docker.sock). You can inspect active sockets using netstat -tuln or ss -tuln to see listening ports and established connections.

Related terms