Skip to main content
Definition Website Computer and Technology

Socket

Subject: Computer and Technology noun /ˈsɑː.kɪt/ 1 definition

  1. Definition (noun)

    Entry #20 · Updated

    A Socket is a bidirectional software communication endpoint managed by the operating system that enables running processes to exchange data over a network or locally on the same machine. On IP networks, a socket is typically identified by combining an IP address, a port number, and a transport protocol, and is exposed to applications as a file descriptor or handle via system calls such as socket(), bind(), listen(), and connect(). Acting strictly as the interface between user-space software and the kernel's networking or inter-process communication stack, a socket handles data buffering, addressing, and connection state without dictating application-level message formats.

    Common Types

    • Stream Sockets: Deliver reliable, ordered, bidirectional byte streams over a persistent connection—most commonly backed by the Transmission Control Protocol (TCP)—making them standard for HTTP traffic, SSH sessions, and database connections.

    • Datagram Sockets: Transmit discrete, connectionless packets—typically using the User Datagram Protocol (UDP)—prioritizing low overhead and minimal latency over guaranteed delivery or packet ordering in DNS lookups, online gaming, and live media streaming.

    • Unix Domain Sockets: Enable high-throughput inter-process communication between applications on the same host through a filesystem path or abstract kernel namespace, bypassing network-interface routing and TCP/IP stack overhead.

    • Raw Sockets: Provide privileged processes with direct access to lower-level network packets without automatic transport-layer framing, powering diagnostic utilities like ping, packet sniffers, and custom protocol implementations.

    Example

    When a web browser connects to an API server at 198.51.100.10 on port 443, the client operating system opens a stream socket bound to an ephemeral local port and completes a TCP handshake with the server's listening socket. Once established, both processes exchange encrypted HTTPS requests and responses by reading from and writing to their respective socket descriptors until either side closes the connection.