pub unsafe extern "C" fn httpd_socket_recv(
    hd: httpd_handle_t,
    sockfd: c_int,
    buf: *mut c_char,
    buf_len: usize,
    flags: c_int
) -> c_int
Expand description

A low level API to receive data from a given socket

@note This API is not recommended to be used in any request handler. Use this only for advanced use cases, wherein some asynchronous communication is required.

This internally calls the default recv function, or the function registered by httpd_sess_set_recv_override().

@param[in] hd server instance @param[in] sockfd session socket file descriptor @param[in] buf buffer with bytes to send @param[in] buf_len data size @param[in] flags flags for the send() function @return

  • Bytes : The number of bytes received successfully
  • 0 : Buffer length parameter is zero / connection closed by peer
  • HTTPD_SOCK_ERR_INVALID : Invalid arguments
  • HTTPD_SOCK_ERR_TIMEOUT : Timeout/interrupted while calling socket recv()
  • HTTPD_SOCK_ERR_FAIL : Unrecoverable error while calling socket recv()