omegalib  13.1
omicron::TcpServer Class Reference

Implements a Tcp server. More...

#include <Tcp.h>

Public Member Functions

 TcpServer ()
 
 ~TcpServer ()
 
void setPort (int value)
 
int getPort ()
 
virtual void initialize ()
 
virtual void start ()
 
virtual void stop ()
 
virtual void poll ()
 
TcpConnectiongetConnection (int id)
 
- Public Member Functions inherited from omicron::Service
 Service ()
 
int getServiceId ()
 
virtual ~Service ()
 
ServiceManagergetManager ()
 
String getName ()
 
bool isInitialized ()
 
bool isDebugEnabled ()
 Returns true if debug mode is enabled for this service. More...
 
ServicePollPriority getPollPriority ()
 
void setPollPriority (ServicePollPriority value)
 
virtual void setup (Setting &settings)
 
virtual void dispose ()
 
void lockEvents ()
 
void unlockEvents ()
 
EventwriteHead ()
 
EventreadHead ()
 
EventreadTail ()
 
EventgetEvent (int index)
 
void doSetup (ServiceManager *mng, Setting &settings)
 
void doInitialize (ServiceManager *sm, int serviceId)
 
- Public Member Functions inherited from omicron::ReferenceType
 ReferenceType ()
 
virtual ~ReferenceType ()
 
void ref ()
 
void unref ()
 
long refCount ()
 

Protected Member Functions

virtual TcpConnectioncreateConnection (const ConnectionInfo &ci)
 Called when a new client connected. More...
 
virtual void accept ()
 
virtual void handleAccept (TcpConnection *newConnection, const asio::error_code &error)
 

Additional Inherited Members

- Public Types inherited from omicron::Service
enum  ServiceType {
  Pointer = EventBase::ServiceTypePointer, Mocap = EventBase::ServiceTypeMocap, Keyboard = EventBase::ServiceTypeKeyboard, Controller = EventBase::ServiceTypeController,
  Ui = EventBase::ServiceTypeUi, Generic = EventBase::ServiceTypeGeneric, Brain = EventBase::ServiceTypeBrain, Wand = EventBase::ServiceTypeWand,
  Speech = EventBase::ServiceTypeSpeech
}
 This enumeration is kept for compatibility reason and may be removed in the future. More...
 
enum  ServicePollPriority { PollFirst, PollNormal, PollLast }
 
- Static Public Member Functions inherited from omicron::ReferenceType
static void printObjCounts ()
 
- Static Protected Attributes inherited from omicron::ReferenceType
static List< ReferenceType * > mysObjList
 

Detailed Description

Implements a Tcp server.

The server listens to client connections and handles communication with each client. To implement custom servers, users derive the TcpServer class and reimplement the createConnection method, to create custom TcpConnection instances That contains the user-defined communication logic (see TcpConnection). The TcpServer is implemented as an omicron service, so it will run automatically in the background when users register it with ServiceManager. TcpServer can also be used without ServiceManager, by calling the intialize(), start(), stop() and poll() methods directly.

+ Inheritance diagram for omicron::TcpServer:

Constructor & Destructor Documentation

omicron::TcpServer::TcpServer ( )
omicron::TcpServer::~TcpServer ( )

Member Function Documentation

virtual void omicron::TcpServer::accept ( )
protectedvirtual
virtual TcpConnection* omicron::TcpServer::createConnection ( const ConnectionInfo ci)
protectedvirtual

Called when a new client connected.

Creates a TcpConnection instance to handle communication User code should reimplement this method.

Reimplemented in omega::MissionControlServer, and omicron::AssetCacheService.

TcpConnection* omicron::TcpServer::getConnection ( int  id)
int omicron::TcpServer::getPort ( )
inline
virtual void omicron::TcpServer::handleAccept ( TcpConnection newConnection,
const asio::error_code &  error 
)
protectedvirtual
virtual void omicron::TcpServer::initialize ( )
virtual

Reimplemented from omicron::Service.

Reimplemented in omega::MissionControlServer, and omicron::AssetCacheService.

virtual void omicron::TcpServer::poll ( )
virtual

Reimplemented from omicron::Service.

void omicron::TcpServer::setPort ( int  value)
inline
virtual void omicron::TcpServer::start ( )
virtual

Reimplemented from omicron::Service.

virtual void omicron::TcpServer::stop ( )
virtual

Reimplemented from omicron::Service.


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