A lightweight CoAP (Constrained Application Protocol) client simulator written in modern C++17, using the libcoap
library. This project demonstrates how to send CoAP requests over UDP, ideal for learning or testing IoT protocols in constrained environments.
- 📡 Send CoAP GET requests
- 🛰️ Simulate client behavior in IoT environments
- 🔧 Easily extensible for PUT/POST/OBSERVE
- 📦 CMake-based build system
- 🧪 Compatible with real CoAP servers like
coap.me
CoAP-Simulator/
├── include/
│ └── coap_client.hpp # CoAP client class definition
├── src/
│ ├── coap_client.cpp # CoAP client implementation
│ └── main.cpp # Entry point for simulation
├── CMakeLists.txt # Build configuration
├── .gitignore # Ignored files
├── LICENSE # License file (MIT by default)
└── README.md # You're here!
- OS: Linux (Ubuntu recommended)
- C++17 or higher
- libcoap development files
git clone https://github.com/yousefsmt/CoAP-Protocol.git
cd CoAP-Protocol
sudo apt update
sudo apt install cmake g++ libcoap3 libcoap3-dev
mkdir build
cd build
cmake ..
make
./coap_simulator
By default, the client sends a GET request to a test server (e.g., coap.me
). You can modify main.cpp
to set a custom URI or test different message types.
Use Wireshark or tcpdump
to inspect UDP packets.
- Default CoAP UDP port is 5683.
Feature | CoAP | HTTP |
---|---|---|
Transport | UDP | TCP |
Encoding | Binary | Text (ASCII) |
Multicast | Yes | No |
Lightweight | ✅ | ❌ |
This project is licensed under the MIT License.