The libevl tree comes with an example illustrating a basic usage of the EVL network stack implementing a simple UDP user program, named oob-net-udp. In order to run this example, you need two computers on the same ethernet LAN, one for sending datagrams, the other for receiving them. A message is sent every second.
You could also use a single system with out-of-band UDP communications flowing through the loopback device (’lo’) as well, since the latter is out-of-band capable.
The general usage of this demo is as follows:
oob-net-udp -a <IP-address> [-p <port>][-m <text>][-n <msgcount>][-i <iterations>][-d][-s][-R|-S]
where:
-a
-p
-m
-n
-i
-d raises the verbosity of the demo to debug mode, such as displaying the content of the packets received.
-s tames down the verbosity of the demo to silent mode, no output will be produced in this mode.
-R switches the demo to receiver mode.
-S switches the demo to sender mode.
You need to set up a basic out-of-band network as described by this document. For this example, unless you go for using the loopback device, we need two out-of-band enabled target systems running EVL. Each system must provide a network device with an out-of-band port.
In its receiver form (-R
switch is given), the UDP demo program
waits for datagram on the specified address and port. Say we have two
peers set up for out-of-band communications:
On the first host which has established an out-of-band port on some network device with a IPv4 address set to 10.10.10.10
~# /usr/bin/oob-net-udp -a 10.10.10.10 -R
== sender mode (=> 127.0.0.1:42042)
= 14 bytes received: Mellow sword!
= 14 bytes received: Mellow sword!
= 14 bytes received: Mellow sword!
In its receiver form (-S
switch is given), the UDP demo program
emits datagrams to the specified address and port (42042 by default).
On the second host which has established an out-of-band port on some network device with a IPv4 address set to 10.10.10.11
~# /usr/bin/oob-net-udp -a 10.10.10.10 -S
As mentioned earlier, you can run this simple demo on the loopback device of a single machine, as follows:
~# evl net -ei lo
~# oob-net-udp -R -a 127.0.0.1&
[1] 516
== receiver mode (<= 127.0.0.1:42042)
== bound to port 42042
~# oob-net-udp -S -a 127.0.0.1
== sender mode (=> 127.0.0.1:42042)
... (the receiver is now displaying the incoming frames)
= 14 bytes received: Mellow sword!
= 14 bytes received: Mellow sword!
= 14 bytes received: Mellow sword!
...