Quiz Entry - updated: 2026.07.05
What is a socket and a socket pair?
A socket is an IP address plus a port number; a socket pair is the source and destination sockets together, which uniquely identifies a single conversation.
Sockets and Socket Pairs:
Socket: The combination of an IP address and a port number.
Socket Pair: The combination of source and destination sockets that uniquely identifies a conversation.
Format:
Source Socket: 192.168.1.5:49152
Destination Socket: 93.184.216.34:80
Socket Pair: 192.168.1.5:49152 ↔ 93.184.216.34:80
Why Sockets Matter:
- Enable multiple processes on a client to distinguish themselves
- Allow multiple connections to a server process
- Uniquely identify each conversation
Example - Multiple Browser Tabs:
Tab 1: 192.168.1.5:49152 ↔ server:80
Tab 2: 192.168.1.5:49153 ↔ server:80
Tab 3: 192.168.1.5:49154 ↔ server:80
Each tab uses a different source port to maintain separate sessions.
Go deeper:
Network socket — defines the socket as an IP+port endpoint and the 4-tuple socket pair.
Port (computer networking) — the port half of the socket and how it scopes a service.