[][src]Function libcoap_sys::coap_write

pub unsafe extern "C" fn coap_write(
    ctx: *mut coap_context_t,
    sockets: *mut *mut coap_socket_t,
    max_sockets: c_uint,
    num_sockets: *mut c_uint,
    now: coap_tick_t
) -> c_uint

For applications with their own message loop, send all pending retransmits and return the list of sockets with events to wait for and the next timeout The application should call coap_read, then coap_write again when any condition below is true:

  • data is available on any of the sockets with the COAP_SOCKET_WANT_READ
  • an incoming connection is pending in the listen queue and the COAP_SOCKET_WANT_ACCEPT flag is set
  • at least some data can be written without blocking on any of the sockets with the COAP_SOCKET_WANT_WRITE flag set
  • a connection event occured (success or failure) and the COAP_SOCKET_WANT_CONNECT flag is set
  • the timeout has expired Before calling coap_read or coap_write again, the application should position COAP_SOCKET_CAN_READ and COAP_SOCKET_CAN_WRITE flags as applicable.

@param ctx The CoAP context @param sockets array of socket descriptors, filled on output @param max_sockets size of socket array. @param num_sockets pointer to the number of valid entries in the socket arrays on output @param now Current time.

@return timeout as maxmimum number of milliseconds that the application should wait for network events or 0 if the application should wait forever.