Skip navigation

embOS/IP - CoAP Server/Client

  • Low memory footprint.
  • GET, DELETE, PUT, POST supported.
  • Confirmable (CON) and non-confirmable (NON) requests supported.
  • The server supports multiple clients.
  • Independent of the UDP/IP stack: any stack with sockets can be used.
  • Block transfer supported.
  • Observe option supported.
  • Example applications included.
  • Demo included with various options, request types, observable data.
  • Project for executable on PC for Microsoft Visual Studio included.

The embOS/IP Constrained Application Protocol (CoAP) client/server is an optional extension which adds CoAP support to the stack. It combines a maximum of performance with a small memory footprint.

The CoAP server allows an embedded system to handle CoAP requests from a CoAP client. The CoAP client allows an embedded system to send request to a CoAP server.

Relevant Parts

The CoAP client/server implements the relevant parts of the following Request For Comments (RFC).

RFC#Description
[RFC 7252]The Constrained Application Protocol (CoAP) 
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc7252.txt
[RFC 6690]Constrained RESTful Environments (CoRE) Link Format
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc6690.txt
[RFC 7641]Observing Resources in the Constrained Application Protocol (CoAP)
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc7641.txt
[RFC 7959]Block-Wise Transfers in the Constrained Application Protocol (CoAP)
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc7959.txt


The following table shows the contents of the embOS/IP CoAP root directory: 

DirectoryContent
ApplicationContains the example application to run the CoAP client/server with embOS/IP.
ConfigContains the CoAP configuration file. Refer to the documentation for detailed information.
IncContains the required include files.
IPContains the CoAP sources and header files.
Windows\IP\CoAP_ServerContains the source, the project files and an executable to run the embOS/IP CoAP server example on a Microsoft Windows host.
Windows\IP\CoAP_ClientContains the source, the project files and an executable to run the embOS/IP CoAP client on a Microsoft Windows host.

Requirements

TCP/IP stack

The embOS/IP CoAP client/server requires an UDP/IP stack. It is optimized for embOS/IP, but any RFC-compliant UDP/IP stack can be used. The shipment includes a Win32 simulation, which  uses  the  standard  Winsock  API  and  an  implementation  which  uses  the socket API of embOS/IP.

Multi tasking

The client/server does not require any multi-tasking environment to run. But the various CoAP APIs are not thread safe and should be protected accordingly if used in different threads.

CoAP background

The Constrained Application Protocol (CoAP) is an Internet of Things (IoT) protocol which allows machine to machine (M2M) communication with small footprint applications. It uses Uniform Resource Identifier (URI) to identify resources on the server. With its small and simple 4 bytes header, it's ideal for devices with limited resources.

The CoAP protocol implements a RESTful client-server based on four methods:

  • GET: The GET method retrieves a representation for the information that currently corresponds to the resource identified by the request URI.
  • PUT: The PUT method requests that the resource identified by the request URI be updated with the enclosed representation.
  • POST: The POST method requests that the representation enclosed in the request be processed to create a new resource or update an existing one.
  • DELETE: The DELETE method requests that the resource identified by the request URI be deleted.

The CoAP protocol is based on UDP (or DTLS for the secured version) and thus has to deal with potential message loss and repetition. It is a simple message exchange between endpoints.

It relies on confirmable (CON) or non-confirmable (NON) messages.

The embOS/IP CoAP server implementation can not be used as a proxy. But the client can send requests to a CoAP proxy.

Block transfer option

The embOS/IP CoAP client/server supports the block transfer option. This option allows to transfer big amounts of data cut into smaller chunks. This is especially useful when the network MTU is relatively small or when the system implementing the CoAP client/server has strong constrains on memory usage.

Observe option

The embOS/IP CoAP client/server supports the observe option. With this option, a client does not have to poll a server periodically to monitor the state of a resource. It can instead register to the resource and be automatically notified by the server when the resource changes.

Resource usage

ROM Usage

The ROM usage depends on the compiler options, the compiler version and the used CPU. The memory requirements of the CoAP client/server presented in the tables below have been measured on a Cortex-M4 system with the default configuration.

Add-onROM
embOS/IP CoAP clientApproximately 6.5 KByte
embOS/IP CoAP serverApproximately 9.2 KByte

RAM Usage

All the RAM used is taken from buffers given by the application.

Add-onRAM
embOS/IP CoAP clientMinimal configuration 456 Bytes. More for observer usage and bigger message buffer.
embOS/IP CoAP serverMinimal configuration 548 Bytes + 48 bytes per resources. More for observer usage and bigger message buffer.