This is a simple example demonstrating how to establish communication between a Python server and a C client using Protocol Buffers (protobuf) for data serialization and deserialization.
- The Python server will listen for incoming connections.
- The C client will establish a connection to the server.
- The C client will send a sample message of type 1 (TYPE_ONE) to the server.
- The Python server will receive the message, parse it, and print the value.
- The Python server will send a response message of type 2 (TYPE_TWO) back to the client.
- The C client will receive the response message from the server and print the received message.
-
Protoc compiler & C library for protobuf generated code
sudo apt install protobuf-compiler libprotobuf-c-dev
-
Generate c and python code from protobuf & compile c code
make
-
Run server and client
#server python3 server-python.py #client ./client