Sockets Defined

A socket is a software concept for a connection. Sockets enable applications to connect to a Transmission Control Protocol/Internet Protocol (TCP/IP) network.

An application running on a host creates a socket or doorway to connect with an application on another host. Messages pass through this socket or doorway.

Click image to enlarge.

Sockets Enable Virtual TCP or UDP Connections Between Hosts

Sockets enable virtual TCP or UDP communication channels between hosts.

When an application starts on a host, a port number is assigned to a process or a function running in it. When that application wants to communicate with another host, (go to a website for example) a socket is created.

This example shows three applications requiring three TCP communication channels: Two channels for each of the two web browsers acting as HTTP clients, and one for the email application acting as an SMTP client.


Sockets Implemented as TX & RX buffers

Sockets are physically implemented as transmit (TX) & receive (RX) memory buffers.

When an application wants to transmit a message, a process writes to the socket’s transmit buffer. This same process periodically checks the socket’s receive buffer for messages being sent by the host on the other end of the virtual connection.

The Transport layer delivers messages to the application by writing them to the socket’s receive buffer. The Transport layer also periodically polls the socket’s transmit buffer to determine if there are messages to send.

© 2021 Microchip Technology, Inc.