Files
libcoap/examples/riot
Jon Shallow ea6a3c6f53 Platforms: Split out TCP and UDP socket functions on a platform basis
Currently supported types

Posix
LwIP
Contiki
RIOT

Zephyr and Windows are treated as Posix.

UDP
src/coap_dgrm_contiki.c      Datagram r/w/c functions from src/coap_io_contiki.c
src/coap_dgrm_lwip.c         Datagram r/w/c functions from src/coap_io_lwip.c
src/coap_dgrm_posix.c        Datagram r/w/c functions from src/coap_io.c
src/coap_dgrm_riot.c         Datagram r/w/c functions from src/coap_io_riot.c

TCP
src/coap_strm_contiki.c      Stub TCP entries
src/coap_strm_lwip.c         Stream r/w/c functions from src/coap_io_lwip.c
src/coap_strm_posix.c        Was src/coap_tcp.c with stream r/w/c functions from src/coap_io.c
src/coap_strm_riot.c         Stream r/w/c functions from src/coap_io_riot.c

I/O specific
src/coap_io_contiki.c        Datagram / Stream functions removed
src/coap_io_lwip.c           Datagram / Stream functions removed
src/coap_io_posix.c          Abstracted from src/coap_io.c
src/coap_io_riot.c           Datagram / Stream functions removed

Remaining common I/O functions
src/coap_io.c                With separated out code removed
2025-09-22 10:27:14 +01:00
..
2025-04-14 12:34:10 +01:00

Example of libcoap running on RIOT
==================================

To build the examples, do

    $ make

This will

* download RIOT from the upstream git sources
* update the RIOT environment with pkg/libcoap, examples/libcoap-client
  and examples/libcoap-server taken from pkg_libcoap/, examples_client/
  and examples_server respectively/.
  (updates RIOT's libcoap code to the latest commited version in your
   environment, along with any modified files).
* build the client application
* build the server application

To run (and/or rebuild) the server application

* cd RIOT/examples-libcoap-server
* make RIOT_CI_BUILD=1
* make term
* (at the shell prompt) coaps start
* (or at the shell prompt) coaps stop

The server creates a resource for 'time' with a query 'ticks'.  This is
reported for `.well-known/core`. The work flow for adding more resources does
not differ from regular libcoap usage.

To run (and/or rebuild) the client application

* cd RIOT/examples-libcoap-client
* make RIOT_CI_BUILD=1
* make term
* (at the shell prompt) coapc coap://[ip-6-address]/some/path

The client will try to connect to the URI defined in app.config named
CONFIG_LIBCOAP_CLIENT_URI (unless overridden by running 'make menuconfig'),
or as specified in the parameter after the coapc.

Note to developers
==================

PKG_VERSION= in pkg_libcoap/Makefile needs updating if you need a different
version of libcoap to get initially installed into RIOT/pkg/libcoap.

Kconfig support is available. Running make in the libcoap distribution
examples/riot directory will try to add in a 'rsource "libcoap/Kconfig"'
entry into RIOT/pkg/Kconfig