SL-TCP
ServiceLink Transmission Control Protocol (SL-TCP) is the connection-oriented, stateful transport protocol of the NSLP stack. It is designed specifically for mission-critical payloads where guaranteed, strictly ordered delivery is strictly required (such as dispatching system configuration changes, triggering physical actuators, or sending state-machine commands). It also implements NSLP packet fragmentation to accommodate payloads that exceed the Layer 2 MTU.
When encapsulated within a Layer 2 Network packet, SL-TCP payloads are identified by the Protocol ID 0x01.
Because SL-TCP must ensure absolute data certainty over potentially unreliable mediums, it trades a small amount of bandwidth and latency for explicit delivery tracking, fragmentation and automated retries.
Delivery Mechanics (Stop-and-Wait)
Standard TCP implementations rely on complex "sliding windows" and massive packet buffers that quickly exhaust the RAM of constrained microcontrollers. To maintain a lightweight footprint, SL-TCP implements a highly reliable, synchronous Stop-and-Wait ARQ (Automatic Repeat reQuest) mechanism.
It guarantees delivery through a strict three-step cycle:
- Transmit and Block: The sender creates an SL-TCP, transmits it, and immediately blocks any further transmissions for that specific stream. A localized timeout timer is started.
- Acknowledge: Upon successfully receiving and validating the frame, the receiving device immediately generates a reply frame. Crucially, the receiver places the sender's original sequence number into the reply's
sequence numberfield, reply'sof sequence numberfield must be set to0. - Resolve:
- Success: If the sender receives a frame with a matching ACK before its timer expires, the transmission is marked as successful. The block is lifted, and the sender can transmit the next payload.
- Retry: If the timeout expires before a valid ACK arrives (indicating a dropped packet at Layer 1 or Layer 2), the sender assumes the data was lost and automatically retransmits the exact same frame.
This primitive but bulletproof loop guarantees that the Application Layer (L4) processes state-changes exactly once, and in the exact sequence they were dispatched.
SL-TCP Frame Structure
General structure
| 0 | 1 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| Source Port | Destination Port | ||||||||||||||
| Sequence Number | Of Sequence Number | ||||||||||||||
| Size | Data (Bytes 0) | ||||||||||||||
| Data (Bytes 1 - 245) | |||||||||||||||
Fields
- Source Port (8 bits): The port identifier of the sending application process.
- Destination Port (8 bits): The port identifier of the target process on the receiving device.
- Sequence Number (8 bits): A number of specific fragment. They always start at 1.
- Payload packets: The sequence number always starts at
1and increments with each new fragment. It must now wrap back to0after reaching255, this is where SL-TCP's MTU size comes from. - Acknowledgement Packets: When the
Of Sequence Numberfield is set to0, theSequence Numberfield is repurposed to indicate the specific fragment being acknowledged, rather than a new data fragment.
- Payload packets: The sequence number always starts at
- Of Sequence Number (8 bits): The total number of fragments in the current transmission. This allows the receiver to know when it has received the final fragment and can safely reassemble the complete payload for Layer 4 processing.
- Payload packets: The of sequence number always has number of frames in this transfer.
- Acknowledgement Packets: A
of sequence numberof0is strictly reserved to designate an acknowledgement packet.
- Size (8 bits): The exact size of the payload being transmitted.
- Data (up to 246 bytes): The fragmanted Layer 4 payload (e.g., custom user structs).
info
The maximum payload size of 62,730 bytes ensures the entire frame remains within acceptable application limits while accounting for the mandatory 5-byte SL-TCP header.
TL;DR
SL-TCP protocol code is 0x01 its MTU is 62730 bytes due to the 5-byte header and 8-bit sequence numbers. It implements a stop-and-wait ARQ mechanism for guaranteed delivery, with explicit acknowledgments and automatic retries.