Definition of socket in The Network Encyclopedia.

What is Socket?

A logical endpoint for communication between two hosts on a TCP/IP network. A socket is also an application programming interface (API) for establishing, maintaining, and tearing down communication between TCP/IP hosts. Sockets were first developed for the Berkeley UNIX platform as a way of providing support for creating virtual connections between different processes.

How It Works

Sockets provide a mechanism for building distributed network applications such as client/server applications. Two sockets form a complete bidirectional communication path between processes on two different TCP/IP hosts. Network-aware applications and services can create and destroy sockets as needed.

As an endpoint for network communication between hosts, a socket is uniquely identified by three attributes:

  • The host’s IP address
  • The type of service needed - for example, a connectionless protocol such as User Datagram Protocol (UDP) or a connection-oriented protocol such as Transmission Control Protocol (TCP)
  • The port number used by the application or service running on the host

For example, the following identifier would represent a socket for the Simple Mail Transfer Protocol (SMTP) mail service running on a host with the specified IP address. (Port 25 is the well-known port number for the SMTP service on a TCP/IP host.) (TCP port 25)

In the Win32 programming environment, sockets are implemented using a programming interface called Windows Sockets. Windows Sockets on Microsoft Windows platforms supports most Internet protocols and services, such as Hypertext Transfer Protocol (HTTP), File Transfer Protocol (FTP), and Telnet.

Web References