rasdaman complete source
|
#include <akgnet_server.hh>
Public Member Functions | |
GenericServer () throw () | |
Default constructor. More... | |
virtual | ~GenericServer () throw () |
Destructor. More... | |
virtual bool | runServer ()=0 throw () |
void | shouldExit () throw () |
Instructs the server to leave the loop (runServer()) More... | |
void | setListenPort (int) throw () |
Sets the listen port. More... | |
int | getListenPort () throw () |
Returns the listen port. More... | |
void | setTimeout (int sec, int milisec) throw () |
void | disableTimeout () throw () |
Disables timeout, means wait unlimited. More... | |
Protected Member Functions | |
bool | initListenSocket (int port, bool nonblocking) throw () |
Init the listen socket. More... | |
bool | connectNewClient (ServerSocket &) throw () |
void | closeSocket (Socket &) throw () |
Protected Attributes | |
ListenSocket | listenSocket |
int | listenPort |
Selector | selector |
bool | exitRequest |
Abstract base class for servers. Offers basic functionality for opening the listen socket and accepting a new connection and other helper functions for more evoluate servers
akg::GenericServer::GenericServer | ( | ) | ||
throw | ( | |||
) |
Default constructor.
|
virtual |
Destructor.
|
protected |
|
protected |
Connects a new client by accepting the connection and setting the ServerSocket in read modus
void akg::GenericServer::disableTimeout | ( | ) | ||
throw | ( | |||
) |
Disables timeout, means wait unlimited.
int akg::GenericServer::getListenPort | ( | ) | ||
throw | ( | |||
) |
Returns the listen port.
Init the listen socket.
|
pure virtual |
Pure function to run the server. Has to initialize the listen socket, than makes a loop by listening, accepting and dispatching the connection for processing. It should'n throw, it has to handle correcty every exception
Implemented in akg::NbCommunicator, and akg::BlockingServer.
void akg::GenericServer::setListenPort | ( | int | ) | ||
throw | ( | ||||
) |
Sets the listen port.
void akg::GenericServer::setTimeout | ( | int | sec, |
int | milisec | ||
) | |||
throw | ( | ||
) |
Sets the timeout, how much time the selector should wait for incomming requests
void akg::GenericServer::shouldExit | ( | ) | ||
throw | ( | |||
) |
Instructs the server to leave the loop (runServer())
|
protected |
|
protected |
|
protected |
|
protected |