View a list of all libcoap examples here.
The riot operating system (https://riot-os.org/) is an operating system for the Internet of Things that currently supports many platforms. One of the main advantages of riot is that it supports programs and libraries written in C including libcoap.
In this github repository you will find an example of a CoAP server for the riot operating system https://github.com/nikosft/libcoap/tree/master/riot This server implements a default resource that outputs "Hello World!".In order to test the example, download the latest version of the rios os (https://github.com/RIOT-OS/RIOT), create a folder inside the examples directory and copy the code from https://github.com/nikosft/libcoap/tree/master/riot in that new directory. Then from a terminal type
$ make
If you encounter any problem, consult this riot wiki page https://github.com/RIOT-OS/RIOT/wiki/Family:-native In order to use the example you have to create a virtual interface in your linux machine. In order to do this invoke the following utility:
$ <riot directory>/dist/tools/tapsetup/tapsetup -c1
This utility will create a virtural interface and a bridge (for more information visit this wiki page https://github.com/RIOT-OS/RIOT/wiki/Virtual-riot-network). After this step, from the folder where you have put the example code invoke:
$ make term
This command will execute the binary created in the previous step and soon an ipv6 address will appear in the terminal. You can now access the coap server using the libcoap coap client and the displayed ipv6 address, by invoking the following command:
$ coap-client coap://[<ipv6 address>%tapbr0]
The riot operating system (https://riot-os.org/) is an operating system for the Internet of Things that currently supports many platforms. One of the main advantages of riot is that it supports programs and libraries written in C including libcoap.
In this github repository you will find an example of a CoAP server for the riot operating system https://github.com/nikosft/libcoap/tree/master/riot This server implements a default resource that outputs "Hello World!".In order to test the example, download the latest version of the rios os (https://github.com/RIOT-OS/RIOT), create a folder inside the examples directory and copy the code from https://github.com/nikosft/libcoap/tree/master/riot in that new directory. Then from a terminal type
$ make
If you encounter any problem, consult this riot wiki page https://github.com/RIOT-OS/RIOT/wiki/Family:-native In order to use the example you have to create a virtual interface in your linux machine. In order to do this invoke the following utility:
$ <riot directory>/dist/tools/tapsetup/tapsetup -c1
This utility will create a virtural interface and a bridge (for more information visit this wiki page https://github.com/RIOT-OS/RIOT/wiki/Virtual-riot-network). After this step, from the folder where you have put the example code invoke:
$ make term
This command will execute the binary created in the previous step and soon an ipv6 address will appear in the terminal. You can now access the coap server using the libcoap coap client and the displayed ipv6 address, by invoking the following command:
$ coap-client coap://[<ipv6 address>%tapbr0]