The structure and properties of a socket are defined by an application programming interface (API) for the networking architecture.
Similarly, the term port is used for external physical endpoints at a node or device.
They are used as service types, and, once created by a process, serve as an externally (from the network) addressable location component, so that other hosts may establish connections.
An application can communicate with a remote process by exchanging data with TCP/IP by knowing the combination of protocol type, IP address, and port number.
The operating system forwards the payload of incoming IP packets to the corresponding application by extracting the socket address information from the IP and transport protocol headers and stripping the headers from the application data.
In the standard Internet protocols TCP and UDP, a socket address is the combination of an IP address and a port number, much like one end of a telephone connection is the combination of a phone number and a particular extension.
Based on this address, Internet sockets deliver incoming data packets to the appropriate application process.
On Unix-like operating systems and Microsoft Windows, the command-line tools netstat or ss[3] are used to list established sockets and related information.
Computer processes that provide application services are referred to as servers, and create sockets on startup that are in the listening state.
A UDP server process handles incoming datagrams from all remote clients sequentially through the same socket.
Only in 1989, however, could UC Berkeley release versions of its operating system and networking library free from the licensing constraints of AT&T's copyright-protected Unix.
In c. 1987, AT&T introduced the STREAMS-based Transport Layer Interface (TLI) in UNIX System V Release 3 (SVR3).
In multilayer switches and quality of service (QoS) support in routers, packet flows may be identified by extracting information about the socket pairs.