Server¶
-
class
server
¶ The server class serves as the basis for writing an HTTP application with SHOW. Creating a server object allows the application to handle HTTP requests on a single IP/port combination.
-
server
(const std::string &address, unsigned int port, int timeout = -1)¶ Constructs a new server to serve on the given IP address and port. The IP address will typically be
localhost
/0.0.0.0
/::
. The port should be some random higher-level port chosen for the application.The timeout is the maximum number of seconds
serve()
will wait for an incoming connection before throwingconnection_timeout
. A value of 0 means thatserve()
will return immediately if there are no connections waiting to be served; -1 meansserve()
will wait forever (until the program is interrupted).
-
~server
()¶ Destructor for a server; any existing connections made from this server will continue to function
-
connection
serve
()¶ Either returns the next connection waiting to be served or throws
connection_timeout
.
-
const std::string &
address
() const¶ Get the address this server is servering on
-
unsigned int
port
() const¶ Get the port this server is servering on
-
int
timeout
() const¶ Get the current timeout of this server
-
int
timeout
(int)¶ Set the timeout of this server to a number of seconds, 0, or -1
-