Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.
2. Searching for something specific? See our text overview of all tests. Includes 'real teacher' use videos.

Join 30000+ teachers and students using TTIO.

Web socket protocol

WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocket API in Web IDL is being standardized by the W3C.

WebSocket is distinct from HTTP. Both protocols are located at layer 7 in the OSI model and depend on TCP at layer 4. 

The role of sockets in TCP/IP

socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to. An endpoint is a combination of an IP address and a port number

TCP Sockets

A connection between two computers uses a socket.

A socket is the combination of IP address plus port


Imagine sitting on your PC at home, and you have two browser windows open. One looking at the Google website, and the other at the Yahoo website. The connection to Google would be:

Your PC – IP1+port 60200 ——– Google IP2 +port 80 (standard port) The combination IP1+60200 = the socket on the client computer and IP2 + port 80 = destination socket on the Google server.

The connection to Yahoo would be:

your PC – IP1+port 60401 ——–Yahoo IP3 +port 80 (standard port) The combination IP1+60401 = the socket on the client computer and IP3 + port 80 = destination socket on the Yahoo server.

Suggested Video

Source: Additional Reading