Tric Datagram Toolkit
Last updated at 9:10 am UTC on 4 March 2005
This is a simple package that basically adds two things to plain UDP sockets:
- Multiplexing: multiple 'endpoints' on a single UDP socket;
- Reliability: UDP packets are fragmented to stay under the network's MTU as far as possible and each fragment is retransmitted until an ACK is received (or some timer expires).
- All datagrams are sent as 1 or more fragments
- A fragment has the following wire format:
- 1 byte magic code: 16rAA;
- 1 byte protocol version: 1;
- 1 byte fragment type:
- 0=regular fragment
- 1=ACK fragment
- 2=reliable fragment
- 4 bytes datagram id;
- 2 bytes fragment number;
- 2 bytes number of fragments;
- 2 bytes endpoint;
- 0 - (max fragment size - fragment header size) bytes of data (currently 1000 - 23 = 987 bytes).
If a reliable fragment is received, an ACK fragment with the same header but minus the data is sent back. The reliable sending process attempts retransmits until each fragment is acknowledged.