The previous code imports the prrt module, creates a PRRT socket, and binds it to all interfaces on UDP port 5000.
You can optionally specify a target_delay (in seconds), which is used by PRRT to execute the hybrid error correction (HEC) and expire packets that take too long to reach the receiver. Depending on the receive calls you are using, data is delivered to the application ASAP or only when the target_delay has passed. The following socket uses a target delay of 50ms:
As the PRRT stack uses multiple threads to separate the transmission and reception of data as well as feedback packets, threads might be migrated between cores by the Linux kernel. This is avoided by the the following socket that uses threadpinning:
This configures the coding to accumulate 4 data packets (k), compute 3 additional (n-k) and sends these as soon as the encoding has finished. Note that the data packets are sent out immediately by the stack and by the time the last packet is sent, the coded redundancy is transmitted.
There are numerous channel parameters that PRRT measures passively and which can be queried from the socket:
data_rate_btl_fwd: The estimated bottleneck data rate on the path from the sender to the receiver. The delivery estimation follows the IETF Draft by Google.
data_rate_btl_back: The estimated bottleneck date rate on the path from receiver to the sender, which was estimated by the sender and communicated within the recently received packets.
loss_rate_fwd: The estimated packet loss rate on the path from sender to the receiver. The receiver keeps a window of recently received packets, computes the number of losses as well as the length of gaps and burst, and communicates this information to the sender via feedback packets.
rtt_prop_fwd: The estimated propagation round-trip time on the path from sender to the receiver. The latency is estimated with a similar approach as NTP uses, so the stamps at the receiver side are part of the feedback packets.
Note that PRRT enforces a maximum transmission unit (MTU), like this.
The data can be received on the receiver by:
Note that there are different modes for reception which take e.g. the target delay into account and differ in their blocking behavior.
The API documentation for C/C++ is not yet available, so please consider the socket.h header file for more information.