Anatomy of a Socket
A socket is composed of a send/receive logic that actually handles UDP and TCP (including HTTP) communications, as well as six buffers.
The sock. object contains properties, methods, and events that relate both to the buffers and the send/receive logic.
The buffers available are:
- The RX buffer, which stores data incoming from the host on the other side of a connection (this buffer doesn't have to be used for HTTP Connections).
- The TX buffer, which stores data that is due for sending to the host on the other side of a connection (for an HTTP connection, this buffer can store both the request and the reply).
- The TX2 buffer, which is used internally and only when inband commands are enabled.
- The CMD buffer, which is used to store incoming inband commands (messages). It is used only when inband commands are enabled.
- The RPL buffer, which is used to store outgoing inband replies (messages). It is used only when inband commands are enabled.
- The VAR buffer, which is used to store HTTP request strings. It is needed only when a socket is in the HTTP mode.
Starting with TiOS V4, there is also a group of TLS-related buffers. TLS stands for "transport layer security" — it is the standard way of performing encrypted data communications over the Internet. Since only a single socket can be engaged in encrypted communications at any given time, this group of TLS buffers is assigned to whichever socket is designated to use TLS.