coap_write() and coap_read() are really internal functions that are called from within coap_run_once() separated by a select() to wait for i/o and ideally should not be used in applications. However, currently, coap_write() and coap_read() are needed instead of coap_run_once() if there is no epoll support in libcoap so that if additional non libcoap FDs need to be set up and monitored by the select() call they then can be processed accordingly if the non libcoap FDs are set in the select() response. coap_io_process_with_fds() is a new function extending coap_run_once() that allows non libcoap FDs to be monitored in the coap_run_once() internal select() call and can then be tested by the caller of coap_io_process_with_fds(). coap_run_once() now calls coap_io_process_with_fds() with readfds, writefds, exceptfds set to NULL and nfds set to 0. Note: nfds, readfds, writefds and exceptfds are ignored if there is underlying epoll support in libcoap as epoll functions are used, not select(). Use coap_context_get_coap_fd() to get a single FD that covers all the libcoap FDs that can be used in the application along with other non-libcoap FDs when there is epoll support. See coap_io(3) for further information. include/coap2/net.h: libcoap-2.map: libcoap-2.sym: man/coap_io.txt.in: src/coap_io.c: Include and document the new coap_io_process_with_fds() function.
libcoap: A C implementation of the Constrained Application Protocol (RFC 7252)
Copyright (C) 2010—2019 by Olaf Bergmann bergmann@tzi.org and others
ABOUT LIBCOAP
libcoap is a C implementation of a lightweight application-protocol for devices that are constrained their resources such as computing power, RF range, memory, bandwidth, or network packet sizes. This protocol, CoAP, is standardized by the IETF as RFC 7252. For further information related to CoAP, see http://coap.technology.
You might want to check out libcoap-minimal for usage examples.
DOCUMENTATION
Documentation and further information can be found at https://libcoap.net.
PACKAGE CONTENTS
This package contains a protocol parser and basic networking functions for platforms with support for malloc() and BSD-style sockets. In addition, there is support for Contiki, LwIP and Espressif/ESP-IDF hosted environments.
The following RFCs are supported
-
RFC7252: The Constrained Application Protocol (CoAP)
-
RFC7641: Observing Resources in the Constrained Application Protocol (CoAP)
-
RFC7959: Block-Wise Transfers in the Constrained Application Protocol (CoAP)
-
RFC7967: Constrained Application Protocol (CoAP) Option for No Server Response
-
RFC8132: PATCH and FETCH Methods for the Constrained Application Protocol (CoAP)
-
RFC8323: CoAP (Constrained Application Protocol) over TCP, TLS, and WebSockets
There is (D)TLS support for the following libraries
-
OpenSSL (Minimum verion 1.1.0)
-
GnuTLS (Minimum version 3.3.0)
-
TinyDTLS
The examples directory contain a CoAP client, CoAP Resource Directory server and a CoAP server to demonstrate the use of this library.
BUILDING
Further information can be found at https://libcoap.net/install.html and BUILDING.
LICENSE INFORMATION
This library is published as open-source software without any warranty of any kind. Use is permitted under the terms of the simplified BSD license. It includes public domain software. libcoap binaries may also include open-source software with their respective licensing terms. Please refer to LICENSE for further details.