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

DumpServer Class Reference

Inheritance diagram for DumpServer:

BasicTcpServer List of all members.

Detailed Description

Definition at line 20 of file dump_server.h.

Public Member Functions

void blockOn ()
 A method to block the calling thread as long as the BasicTcpServer exists.
 DumpServer (int sockPort, int maxClients, const char *intro=NULL)
 DumpServer (int sockPort, const char *intro=NULL)
void init ()
 A method to initialise and start the server.
void send (const char *buf, int nBytes)
 A method to enable/disable printing of debug statements for a single object.
void setDebug (bool onOff)
void setID (const char *id)
 A method to enable/disable printing of debug statements for the class.

Static Public Member Functions

static void setDebugAll (bool onOff)
 A method to enable/disable printing of debug statements for the class.

Protected Member Functions

virtual void onConnect (ClientInfo *curr)
virtual void onDisconnect (ClientInfo *curr)
int readLine (int fd, char *buf, int maxBytes)
int readn (int fd, char *buf, int nBytes, int timeOut)

Protected Attributes

std::list< ClientInfo * > clientList
 List of connected clients.
pthread_mutex_t clientListMutex
 List access mutex.
char errMsg [120]
const char * id
 Identifier for debug output.
std::list< ClientInfo
* >::const_iterator 
pos
 List iterator.
pthread_attr_t threadAttr
sched_param threadParam

Static Protected Attributes

static const int SCHED_POLICY = SCHED_RR


Constructor & Destructor Documentation

DumpServer::DumpServer int  sockPort,
const char *  intro = NULL
 

< Constructor:

Parameters:
sockPort The socket port number.
intro A string that will be sent to the client when it first connects.

Definition at line 30 of file dump_server.cc.


Member Function Documentation

int BasicTcpServer::readLine int  fd,
char *  buf,
int  maxBytes
[protected, inherited]
 

A method to read a line of text from a socket. The method returns when either a newline character is encountered or the specified maximum number of bytes have been read.

Parameters:
fd The open file descriptor for the socket.
buf A pointer to a buffer large enough to hold the number of bytes to be read.
maxBytes The maximum number of bytes to be read.
Returns:
The (positive) number of bytes read on success, 0 if client has closed the socket connection or a negative number from error codes above.

Definition at line 221 of file server.cc.

int BasicTcpServer::readn int  fd,
char *  buf,
int  nBytes,
int  timeOut
[protected, inherited]
 

A method to read a specified number of bytes from a socket.

Parameters:
fd The open file descriptor for the socket.
buf A pointer to a buffer large enough to hold the number of bytes to be read.
nBytes The number of bytes to be read.
timeout The total allowable time in microseconds to complete the read. Minimum value of timeout is 1 microsec per byte.
Returns:
The (positive) number of bytes read on success, zero if client has closed the socket connection or a negative number from error codes above.

Definition at line 157 of file server.cc.


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