Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

BasicUdpServer Class Reference

List of all members.

Detailed Description

Definition at line 30 of file udp_server.h.

Public Member Functions

 BasicUdpServer (int portNum, int maxClients=5, const char *intro=NULL)
void blockOn ()
 A method to block the calling thread as long as the BasicUdpServer exists.
void init ()
 A method to initialise and start the server.
void setDebug (bool onOff)
void setID (const char *id)
 A method to enable/disable printing of debug statements for the class.
virtual ~BasicUdpServer ()

Static Public Member Functions

static void setDebugAll (bool onOff)
 A method to enable/disable printing of debug statements for a single object.

Protected Member Functions

virtual int doServerOp (ClientInfo *ci)=0
virtual void onConnect (ClientInfo *curr)
virtual void onDisconnect (ClientInfo *curr)

Protected Attributes

std::list< ClientInfo * > clientList
 List of connected clients.
pthread_mutex_t clientListMutex
 List access mutex.
const char * id
 Identifier for debug output.

Classes

struct  Arg
struct  ClientInfo
 A structure to hold client identification data. More...


Constructor & Destructor Documentation

BasicUdpServer::BasicUdpServer int  portNum,
int  maxClients = 5,
const char *  intro = NULL
 

Constructor.

Parameters:
portNum The port number of the socket;
maxClients The maximum number of simultaneous client connections allowed.
intro A string that will be sent to the client when it first connects to the server.

Definition at line 34 of file udp_server.cc.

References clientListMutex.


Member Function Documentation

virtual int BasicUdpServer::doServerOp ClientInfo ci  )  [protected, pure virtual]
 

This method is the operation that the server repeatedly performs for each client e.g. send and/or receive data. This method must be implemented in the derived class.

Returns:
A negative number for serious errors and to terminate the connection to the client. This method must be implemented in the derived class.


The documentation for this class was generated from the following files:
Generated on Mon Apr 30 13:32:42 2007 for Parkes M & C - PKMC C++ library API by  doxygen 1.4.4