Server mode.


lwespr_t lwesp_set_server(uint8_t en, lwesp_port_t port, uint16_t max_conn, uint16_t timeout, lwesp_evt_fn cb, const lwesp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)

Enables or disables server mode.

  • en[in] Set to 1 to enable server, 0 otherwise

  • port[in] Port number used to listen on. Must also be used when disabling server mode

  • max_conn[in] Number of maximal connections populated by server

  • timeout[in] Time used to automatically close the connection in units of seconds. Set to 0 to disable timeout feature (not recommended)

  • server_evt_fn[in] Connection callback function for new connections started as server

  • evt_fn[in] Callback function called when command has finished. Set to NULL when not used

  • evt_arg[in] Custom argument for event callback function

  • blocking[in] Status whether command should be blocking or not


lwespOK on success, member of lwespr_t enumeration otherwise