Civetweb API Reference

mg_get_connection_info( ctx, idx, buffer, buflen );


ctxstruct mg_context *The server context handle
idxintConnection index within the context
`bufferchar *A string buffer to store the information
`buflenintSize of the string buffer (including space for a terminating 0)

Return Value

intAvailable context information in bytes (excluding the terminating 0)


The function mg_get_connection_info() returns statistics information collected for a server connection index. This may be empty if the server has not been built with statistics support (#define USE_SERVER_STATS). If data is available, the returned string is in JSON format. The exact content may vary, depending on the connection state and server version.


This is an experimental interface and may be changed, replaced or even removed in the future. Currently the index idx must be between 0 and num_threads-1. The thread is not locked for performance reasons, so the information may be inconsistent in rare cases.

See Also