Socket

Problem

A process needs to exchange data with another process, on the same computer or across a network. It needs a programming abstraction representing that communication endpoint.

Solution — Socket

The operating system exposes sockets as communication endpoints. For network communication, a typical path is:
Application
    ↓
Socket
    ↓
TCP/UDP
    ↓
IP
Applications read and write through the socket while the OS handles the networking stack. For communication on the same computer, Unix domain sockets let an offline app exchange data with a local background service.
Core idea: a socket is an application's communication endpoint, used locally or across a network.