Simple C++ cross-platform client/server app forwarding UDP datagrams through a TCP connection.
Simple cross-platform client/server program forwarding UDP datagrams through a TCP connection (aka tunnel). The client joins a multicast group and forwards the received datagrams to the server, which in turns multicasts them on its own subnet.
Requirements
Installation
Synopsis
Examples
How does it work?
The DTEP Protocol
Licensing
cd <path_to_the_repo>/DatagramTunneler
make
For more info about how to run it, checkout the Synopsis below
./bin/DatagramTunneler -h
In order to use the DatagramTunneler you need to start the server side first, then the client side. If you don’t, the client will just fail to connect to the server and exit right away.
dgramtunneler --server -i <udp_iface_ip> -t <tcp_listen_port> [-u <udp_dst_ip>:<port>]
dgramtunneler --client -i <udp_iface_ip> -t <tcp_srv_ip>:<tcp_srv_port> -u <udp_dst_ip>:<port>
(Don’t forget to give a little star if this tool is useful to you :])
server side:
./bin/datagramtunneler --server -i 192.168.0.104 -u 228.14.28.52:1234 -t 28052
client side:
./bin/datagramtunneler --client -i 192.168.0.105 -u 228.1.2.3:7437 -t 192.168.0.104:28052
The purpose of the DatagramTunneler is to transfer multicast data from one subnet A to another subnet B where that multicast channel is not available. To achieve this, the DatagramTunneler is split into 2 sides: a client side and a server side, as shown on the diagram below:
The client side should run in the subnet where the multicast channel is joinable. Once started it will do the following:
The server side should run in the subnet where the multicast is not available. Once started it will do the following:
The Datagram Tunneler Protocol or DTEP is a simple binary protocol, which is described by the following diagram:
A DTEP packet has a 1 byte header specifying the type of payload it contains.
This type of packet has no payload. It is sent by the client to the server and helps ensure both ends of the connection know if the other end is alive.
This packet encapsulates the datagram observed by the client. Here is its complete description:
Although this diagram should be self explanatory, here is a break down of all the fields: