rasdaman complete source
|
#include <akgnet_nbcomm.hh>
Public Member Functions | |
NbCommunicator () throw () | |
Default constructor. More... | |
NbCommunicator (int newMaxJobs) | |
Constructor setting also the maximal number of simultan jobs. More... | |
~NbCommunicator () throw () | |
Destructor. More... | |
bool | initJobs (int newMaxJobs) |
Sets the maximal number of simultan jobs. More... | |
int | getMaxJobs () throw () |
returns the maximal number of simultan jobs More... | |
bool | attachJob (NbJob &) throw () |
bool | deattachJob (NbJob &) throw () |
bool | runServer () throw () |
This runs the main loop for servers, this means it initializes the listen socket first. More... | |
bool | runClient () throw () |
This runs the main loop for clients, this means without initializing the listen socket. More... | |
![]() | |
GenericServer () throw () | |
Default constructor. More... | |
virtual | ~GenericServer () throw () |
Destructor. More... | |
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 | |
virtual bool | executeBeforeSelect () throw () |
virtual bool | executeAfterSelect () throw () |
virtual bool | executeOnTimeout () throw () |
![]() | |
bool | initListenSocket (int port, bool nonblocking) throw () |
Init the listen socket. More... | |
bool | connectNewClient (ServerSocket &) throw () |
void | closeSocket (Socket &) throw () |
Additional Inherited Members | |
![]() | |
ListenSocket | listenSocket |
int | listenPort |
Selector | selector |
bool | exitRequest |
The heart of the non-blocking communication. It's derived from GenericServer but it is called 'Communicator' since it not only for servers but also for clients You can use this class for most communication purposes, special ones have to reimplement 'executeBeforeSelect()' or 'executeOnTimeout()' A better implementation should use 'vector' Important: new is supposed to throw!
akg::NbCommunicator::NbCommunicator | ( | ) | ||
throw | ( | |||
) |
Default constructor.
akg::NbCommunicator::NbCommunicator | ( | int | newMaxJobs | ) |
Constructor setting also the maximal number of simultan jobs.
akg::NbCommunicator::~NbCommunicator | ( | ) | ||
throw | ( | |||
) |
Destructor.
Attaches a new job. Returns 'true' if succeded, 'false' if the job is already attached or if the maximal number of jobs is already attached
Deattach job. Returns 'true' if succeded, 'false' if the job is not attached
|
protectedvirtual |
Called after select, if it returns 'false' the loop exits. This version just returns 'true'
|
protectedvirtual |
Called before select, if it returns 'false' the loop exits. This version just returns 'true'
|
protectedvirtual |
Called if select times out, if it returns 'false' the loop exits. This version just returns 'true'
int akg::NbCommunicator::getMaxJobs | ( | ) | ||
throw | ( | |||
) |
returns the maximal number of simultan jobs
bool akg::NbCommunicator::initJobs | ( | int | newMaxJobs | ) |
Sets the maximal number of simultan jobs.
bool akg::NbCommunicator::runClient | ( | ) | ||
throw | ( | |||
) |
This runs the main loop for clients, this means without initializing the listen socket.
|
virtual |
This runs the main loop for servers, this means it initializes the listen socket first.
Implements akg::GenericServer.