This project provides definitions and a Python client module to send messages between a client and a server using Protobuf over UDP.
Follow the instructions here - on how to setup the Dev Board.
An example on how to use nine_client.py can be found in test_client.py
- The client first sends a UDP broadcast message to the server
- It's assumed the network is
192.168.100.0and is connected via network interfaceusb0 - If needed you can change these defaults
- It's assumed the network is
- The server sends a response back so that the client knowns at which IP address the server resides
- The client can now send other messages to the server
If you change definitions/nine.proto, you will need to generate the matching python modules (libnine/nine_pb2.py) - at the same time it will also generate C++ files in libcpp.
You can generate the files by running make lib on a Linux machine.
- Run
make serverorpython3 test_server.pyto launch a test server, this will respond to basic discovery and other messages
- You're not able to use the python environment or caches from the Linux host on the dev board - so you cannot just
mdt pushthe host files to the dev board - To copy the files, follow these steps:
- host:
make clean - host:
mdt push . test - host:
mdt shell- to login to the board - board:
cd test - board: Connect an Ethernet cable to allow for Internet access
- board:
make .env/.done - board: Disconnect Ethernet cable
- board:
make client
- host:
- Note: if you connect the Ethernet cable before running mdt shell, you might be connected through the wrong IP, so remove it first so the communication goes through the USB cable