[#HTTPServer] = HTTPServer :mrdocs: Socket‐based HTTP server that accepts connections and dispatches requests to worker threads. == Synopsis Declared in `<httpserver.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class HTTPServer; ---- == Type Aliases [cols="1,4"] |=== | Name| Description | xref:HTTPServer/Id.adoc[`Id`] | Each connection is assigned an unique id of this type. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:HTTPServer/2constructor.adoc[`HTTPServer`] [.small]#[constructor]# | Construct a server that dispatches each parsed request to the given handler. | xref:HTTPServer/2destructor.adoc[`~HTTPServer`] [.small]#[destructor]# [.small]#[virtual]# | Destroy the server, asserting that all threads, connections and listeners were stopped. | xref:HTTPServer/BindAndStartListening.adoc[`BindAndStartListening`] | Bind to a new address:port, start listening and add the listen socket to `m_listen`. | xref:HTTPServer/ClearConnectedClients.adoc[`ClearConnectedClients`] | Force‐remove all remaining clients from m_connected without waiting for graceful disconnection. Must only be called after JoinSocketsThreads(). | xref:HTTPServer/DisconnectAllClients.adoc[`DisconnectAllClients`] | Start disconnecting clients when possible in the I/O loop | xref:HTTPServer/GetConnectionsCount.adoc[`GetConnectionsCount`] | Get the number of HTTPRemoteClients we are connected to | xref:HTTPServer/GetListeningSocketCount.adoc[`GetListeningSocketCount`] | Get the number of sockets the server is bound to and listening on | xref:HTTPServer/InitHTTPAllowList.adoc[`InitHTTPAllowList`] | Parse the user's ‐rpcallowip settings and populate m_allow_subnets | xref:HTTPServer/InterruptNet.adoc[`InterruptNet`] | Stop network activity | xref:HTTPServer/JoinSocketsThreads.adoc[`JoinSocketsThreads`] | Join (wait for) the threads started by `StartSocketsThreads()` to exit. | xref:HTTPServer/SetMaxConnections.adoc[`SetMaxConnections`] | Set the maximum amount of connected HTTPClients (‐rpcmaxconnections) | xref:HTTPServer/SetRequestHandler.adoc[`SetRequestHandler`] | Update the request handler method. Used for shutdown to reject new requests. | xref:HTTPServer/SetServerTimeout.adoc[`SetServerTimeout`] | Set the idle client timeout (‐rpcservertimeout) | xref:HTTPServer/StartSocketsThreads.adoc[`StartSocketsThreads`] | Start the necessary threads for sockets IO. | xref:HTTPServer/StopAccepting.adoc[`StopAccepting`] | Stop accepting new connections in the I/O loop. Must be called first in StopHTTPServer() before DisconnectAllClients(). A connection accepted after the "wait for 0 connections" loop exits would remain in m_connected when the destructor is called. | xref:HTTPServer/StopListening.adoc[`StopListening`] | Stop listening by closing all listening sockets. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#