[#HTTPServer]
= HTTPServer
:mrdocs:

Socket&hyphen;based HTTP server that accepts connections and dispatches requests to worker threads&period;

== Synopsis

Declared in `&lt;httpserver&period;h&gt;`

[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&period;
|===


== 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&period;
| xref:HTTPServer/2destructor.adoc[`&#126;HTTPServer`] [.small]#[destructor]# [.small]#[virtual]#
| Destroy the server, asserting that all threads, connections and listeners were stopped&period;
| xref:HTTPServer/BindAndStartListening.adoc[`BindAndStartListening`] 
| Bind to a new address&colon;port, start listening and add the listen socket to `m&lowbar;listen`&period;
| xref:HTTPServer/ClearConnectedClients.adoc[`ClearConnectedClients`] 
| Force&hyphen;remove all remaining clients from m&lowbar;connected without waiting for graceful disconnection&period; Must only be called after JoinSocketsThreads()&period;
| xref:HTTPServer/DisconnectAllClients.adoc[`DisconnectAllClients`] 
| Start disconnecting clients when possible in the I&sol;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&apos;s &hyphen;rpcallowip settings and populate m&lowbar;allow&lowbar;subnets
| xref:HTTPServer/InterruptNet.adoc[`InterruptNet`] 
| Stop network activity
| xref:HTTPServer/JoinSocketsThreads.adoc[`JoinSocketsThreads`] 
| Join (wait for) the threads started by `StartSocketsThreads()` to exit&period;
| xref:HTTPServer/SetMaxConnections.adoc[`SetMaxConnections`] 
| Set the maximum amount of connected HTTPClients (&hyphen;rpcmaxconnections)
| xref:HTTPServer/SetRequestHandler.adoc[`SetRequestHandler`] 
| Update the request handler method&period; Used for shutdown to reject new requests&period;
| xref:HTTPServer/SetServerTimeout.adoc[`SetServerTimeout`] 
| Set the idle client timeout (&hyphen;rpcservertimeout)
| xref:HTTPServer/StartSocketsThreads.adoc[`StartSocketsThreads`] 
| Start the necessary threads for sockets IO&period;
| xref:HTTPServer/StopAccepting.adoc[`StopAccepting`] 
| Stop accepting new connections in the I&sol;O loop&period; Must be called first in StopHTTPServer() before DisconnectAllClients()&period; A connection accepted after the &quot;wait for 0 connections&quot; loop exits would remain in m&lowbar;connected when the destructor is called&period;
| xref:HTTPServer/StopListening.adoc[`StopListening`] 
| Stop listening by closing all listening sockets&period;
|===



[.small]#Created with https://www.mrdocs.com[MrDocs]#
