This document describes the protocol used by the PURE TCP/UDP server and tasks.
The provided TCP tasks as well as the TCP Server use a simple protocol called ?PURE-TCP?. The protocol is modelled to be able simulate common TCP based protocols (such as FTP, SMTP, etc).
The messages (both request and responses) consist of one text line and an optional payload that simply consists of a number of bytes.
The following describes the PURE-TCP requests and responses in Augmented Backus?Naur Form:
The request commands are:
The responses always includes a response code and an a length. If length is not 0, an payload is included with the specified length.
A response code of 0 indicates success any other response codes are error codes.
The provided UDP tasks as well as the UDP Server use a simple protocol called ?PURE-UDP?. The protocol is modelled to be able simulate common UDP based protocols.
Compared to the PURE-TCP protocol, the PURE-UDP protocol is somewhat more complicated. This due to the nature of UDP, being a non-reliable protocol, so to use it we must have reliability features at the application level to handle dropped packages as well as being able to count packages delivered out of order.
A UDP message is contained within a UDP datagram and has the following layout:
Message Types:
The Payload for CTRL messages include control messages similar as the PURE-TCP protocol. I.e
The command (cmd) is basically the same as for PURE-TCP. The main difference is that we specify number of expected packages to be transmitted. This allows the receiver to calculate package loss.
In order to know if CTRL message has arrived to its destination, it must be acknowledged by the receiver. The sender is storing the message in its memory as long as it is waiting for acknowledge. Once it gets acknowledged, the message can be discarded. In case the message is not acknowledged during some period of time, it can (optionally) be retransmitted.
DATA_NOACK messages are transferred without being acknowledged by the receiver. The receiver will only record received DATA_NOACK messages and count number of missing packages. This is based on that a CTRL message has previously been used to inform the receiver about the number of expected DATA_NOACK messages.
Send simple UDP message, with a 256 byte payload:
An example where multiple packages is used to transfer 4096 bytes, using 4 packages:
Similar, but retrieving data: