mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-12 03:40:39 +03:00
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.