A server manager causes listening on a given port to occur for the duration of its lifetime. More...
#include <network.hpp>
Public Types | |
enum | CREATE_SERVER { MUST_CREATE_SERVER, TRY_CREATE_SERVER, NO_SERVER } |
Parameter to pass to the constructor. More... | |
Public Member Functions | |
server_manager (int port, CREATE_SERVER create_server=MUST_CREATE_SERVER) | |
~server_manager () | |
bool | is_running () const |
void | stop () |
Private Attributes | |
bool | free_ |
connection | connection_ |
A server manager causes listening on a given port to occur for the duration of its lifetime.
Definition at line 81 of file network.hpp.
Parameter to pass to the constructor.
Enumerator | |
---|---|
MUST_CREATE_SERVER |
Will throw exception on failure. |
TRY_CREATE_SERVER |
Will swallow failure. |
NO_SERVER |
Definition at line 84 of file network.hpp.
network::server_manager::server_manager | ( | int | port, |
CREATE_SERVER | create_server = MUST_CREATE_SERVER |
||
) |
Definition at line 311 of file network.cpp.
References network::connect(), connection_, DBG_NW, free_, get_socket(), MUST_CREATE_SERVER, and NO_SERVER.
network::server_manager::~server_manager | ( | ) |
Definition at line 330 of file network.cpp.
References stop().
bool network::server_manager::is_running | ( | ) | const |
Definition at line 345 of file network.cpp.
void network::server_manager::stop | ( | ) |
Definition at line 335 of file network.cpp.
References connection_, free_, and remove_connection().
Referenced by ~server_manager().
|
private |
Definition at line 97 of file network.hpp.
Referenced by server_manager(), and stop().
|
private |
Definition at line 96 of file network.hpp.
Referenced by server_manager(), and stop().