View a list of all libcoap examples here.
This is a simple example of a CoAP server and a CoAP client. The server listens on port 5683 (default port) and responds with a "Hello World!" to every request for the "hello" resource. The response is piggybacked in the ACK message.
The client performs a CoAP GET request for the "coap://127.0.0.1/hello" resource and prints the response.
You can find the source code of this example, as well as, instructions for compiling it in Linux in this github repository, in the "piggybacked" folder.
This is a simple example of a CoAP server and a CoAP client. The server listens on port 5683 (default port) and responds with a "Hello World!" to every request for the "hello" resource. The response is piggybacked in the ACK message.
The client performs a CoAP GET request for the "coap://127.0.0.1/hello" resource and prints the response.
You can find the source code of this example, as well as, instructions for compiling it in Linux in this github repository, in the "piggybacked" folder.