Commit 381508c7 authored by Andreas Schmidt's avatar Andreas Schmidt

Update README and add Python examples.

parent 21657df3
Pipeline #1605 passed with stages
in 1 minute and 29 seconds
# Predictably Reliable Real-Time (PRRT)
## Hardware Timestamping
**PRRT** is a transport protocol that aims to provide predictable reliability and latency. [http://larn.systems]()
* Hardware timestamping can be enabled per socket by calling `PrrtSocket_enable_hardware_timestamping()` and specifying the interface.
* Requirements are a kernel that supports physical timestamping. Instructions can be found
## Features
### Compiling a hardware tmestamping enabled kernel on Ubuntu
* Forward Error Correction (FEC) using systematic Vandermonde codes
* Clock synchronization between sending stack and receiving stack
* Applications can specify packet-level expiration times
* Different receive modes for ASAP and time-synchronized operation
* Packet-level timing analysis using [X-Lap](http://xlap.larn.systems)
* [Hardware timestamping support](https://git.nt.uni-saarland.de/LARN/PRRT/wikis/hardware-timestamping)
* A detailed tutorial on kernel compilation can be found [here](https://help.ubuntu.com/community/Kernel/Compile).
* Create and enter a new folder, e.g. in your home directory that will store the newly compiled kernel.
* Run the following commands to download all resources required:
## Installation
```bash
sudo apt install libncurses5 libncurses5-dev
*See [Installing PRRT](https://git.nt.uni-saarland.de/LARN/PRRT/wikis/installation#python) for instructions on how to install it on your system for using it with C/C++ or Python.*
#### *Try PRRT on your system*
A [minimal receiver](examples/receiver.py), which takes the bind port as an argument, is created as follows:
```python
import sys
import prrt
port = int(sys.argv[1])
sudo apt build-dep linux-image-`uname -r`
apt source linux-image-`uname -r`
s = prrt.PrrtSocket(port=port, isSender=False)
cd linux-$(uname -r | awk '{split($1,a, "-"); print a[1]}')
while True:
d = s.recv()
if d != "Close":
print d
else:
break
```
* Copy the current kernel configuration to the current folder:
A [minimal sender](sender.py) is created as follows:
```python
import sys
import prrt
host = sys.argv[1]
port = int(sys.argv[2])
s = prrt.PrrtSocket(port=port, isSender=True)
s.connect(host, port)
for i in range(10):
s.send("Packet {}".format(i))
s.send("Close")
```
Start the receiver by:
```bash
cp -vi /boot/config-`uname -r` .config
python receiver.py 5000
```
* Edit the `.config` file and ensure the following line is present (and the option is set to `y`):
In a separate terminal, run:
```bash
...
CONFIG_NETWORK_PHY_TIMESTAMPING=y
...
python sender.py 127.0.0.1 5000
```
* Call `make deb-pkg` (ideally with `-j5` or some other number to speed up the compilation by using multiple cores).
* Install the `linux-headers-*.deb` and `linux-image-*.deb` package via `dpkg -i` (where * stands for the respective kernel version).
* Reboot the system.
This should generate the following output in the receiver console:
```terminal
Packet 0
Packet 1
...
Packet 9
```
## Docker
## For more information
The following shows how to run the PRRT sender and receiver on a host with OpenvSwitch.
* [PRRT Wiki](https://git.nt.uni-saarland.de/LARN/PRRT/wikis)
* [LARN Project Website](http://larn.systems)
```bash
bridge=$(docker network create --subnet="10.5.1.0/24" prrt | cut -c1-12)
ovs-vsctl add-port of-switch br-$bridge
docker run --rm --name=prrt_recv --network="prrt" -v=/opt/prrt:/output --ip=10.5.1.52 --cap-add NET_ADMIN docker.nt.uni-saarland.de/larn/prrt:develop receiver -p 5000 -r 127
docker run --rm --name=prrt_send --network="prrt" -v=/opt/prrt:/output --ip=10.5.1.51 --cap-add NET_ADMIN docker.nt.uni-saarland.de/larn/prrt:develop sender -t 10.50.1.52 -p 5000 -r 127 rate 1mbit
```
\ No newline at end of file
## License
[MIT Licence](LICENSE)
import sys
import prrt
port = int(sys.argv[1])
s = prrt.PrrtSocket(port=port, isSender=False)
while True:
d = s.recv()
if d != "Close":
print d
else:
break
import sys
import prrt
host = sys.argv[1]
port = int(sys.argv[2])
s = prrt.PrrtSocket(port=port, isSender=True)
s.connect(host, port)
for i in range(10):
s.send("Packet {}".format(i))
s.send("Close")
......@@ -26,10 +26,10 @@ setup(
'Intended Audience :: Developers',
'Topic :: Communications'
# Supported Python Versions
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4'
'Programming Language :: Python :: 3.5'
],
install_requires=["cython"],
keywords='prrt protocol',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment