On Connection Close
Called after a connection close tryout.
Like for every hook functions, it's only available when the µC/HTTP-client internal task is active (HTTPc_CFG_MODE_ASYNC_TASK_EN
). This hook is mandatory when the internal task is enabled and can be set up with the API functionHTTPc_ConnSetParam()
with the parameter type HTTPc_PARAM_TYPE_CONN_CLOSE_CALLBACK
.
Prototype
void HTTPc_ConnCloseHook(HTTPc_CONN_OBJ *p_conn_obj, CPU_BOOLEAN close_status, HTTPc_ERR err);
Arguments
p_conn_obj
Pointer to the current HTTPc Connection Object.
close_status
Status of the connection close:
DEF_OK
, if the connection with the server was successful closed.
DEF_FAIL
, otherwise.
err
Internal error code when the connection was closed.
Return Values
None.
Required Configuration
The HTTPc Internal Task must be active. See section Task Configuration of the Compile-Time Configuration page.
Notes / Warnings
None.
Example Template
Listing - Connection Close Hook Function Example Code
static void HTTPc_ConnCloseHook (HTTPc_CONN_OBJ *p_conn, CPU_BOOLEAN close_status, HTTPc_ERR err) { printf("Connection closed with error code %i.\n\r", err); }