rasdaman complete source
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
akg::GenericServer Class Referenceabstract

#include <akgnet_server.hh>

Inheritance diagram for akg::GenericServer:
akg::BlockingServer akg::NbCommunicator

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
 

Detailed Description

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

Constructor & Destructor Documentation

akg::GenericServer::GenericServer ( )
throw (
)

Default constructor.

virtual akg::GenericServer::~GenericServer ( )
throw (
)
virtual

Destructor.

Member Function Documentation

void akg::GenericServer::closeSocket ( Socket )
throw (
)
protected

Closes the given Socket and removes it from the Selector

bool akg::GenericServer::connectNewClient ( ServerSocket )
throw (
)
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.

bool akg::GenericServer::initListenSocket ( int  port,
bool  nonblocking 
)
throw (
)
protected

Init the listen socket.

virtual bool akg::GenericServer::runServer ( )
throw (
)
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())

Member Data Documentation

bool akg::GenericServer::exitRequest
protected
int akg::GenericServer::listenPort
protected
ListenSocket akg::GenericServer::listenSocket
protected
Selector akg::GenericServer::selector
protected

The documentation for this class was generated from the following file: