This is a small example for a client-server-based UDP communication.
We use Boost's asio libraries for UDP socket management. You can install them with
sudo apt-get install libboost-system-dev
In a terminal, get the repo with
git clone https://github.com/stefanscherzinger/udp_communication.git
and inside that repo
mkdir build && cd build
cmake ..
make
cmake --install . --prefix $HOME/install
In every new terminal, use
export PATH=$PATH:$HOME/install/bin
to make both the server
and client
binaries globally available.
You can then start them, e.g. with
server 9001
and
client 9001
and watch them communicate on 127.0.0.1
(localhost by default) on port 9001
.