Tuesday, September 6, 2016

Asynchronous CoAP request-response using libcoap

View a list of all libcoap examples here.

This is an example of asynchronous request-response. The server listens on port 5683 (default port). When it receives a request for the "hello" resource, it sends and ACK and after 2 seconds it responds with a "Hello World!".

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 "seperate" folder.