Connection¶
-
class
connection¶ Objects of this type represent a connection between a single client and a server. A connection object can be used to generate
requestobjects; one in the case of HTTP/1.0 or multiple in the case of HTTP/1.1.The connection class has no public constructor (besides the move constructor), and can only be created by calling
server::serve().-
connection(connection&&)¶ Explicit move constructor as one can’t be generated for this class
-
~connection()¶ Destructor for a connection, which closes it; any requests or responses created on this connection can no longer be read from or written to
-
const std::string &
client_address() const¶ The IP address of the connected client
-
unsigned int
client_port() const¶ The port of the connected client
-
const std::string &
server_address() const¶ The address of the server handling the connection
-
unsigned int
server_port() const¶ The port of the server handling the connection
-
int
timeout() const¶ Get the current timeout of this connection, initially inherited from the server the connection is created from
-
int
timeout(int)¶ Set the timeout of this connection independently of the server; the argument is a number of seconds, 0, or -1
See also
-