Sockets

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.

socket_door.JPG
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.png

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.

socket_buffers.png
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.