GClasses
GClasses::GDomServer Class Reference

Detailed Description

This is a socket server that sends and receives DOM nodes.

#include <GSocket.h>

Inheritance diagram for GClasses::GDomServer:
GClasses::GPackageServer

Public Member Functions

 GDomServer (unsigned int port)
 
virtual ~GDomServer ()
 
const GDomNodereceive (GPackageConnection **pOutConn)
 Receive the next available DOM node, or NULL if none are ready. More...
 
void send (GDomNode *pNode, GPackageConnection *pConn)
 Send the specified DOM node. More...
 
- Public Member Functions inherited from GClasses::GPackageServer
 GPackageServer (unsigned short port)
 
virtual ~GPackageServer ()
 
void checkForNewConnections ()
 Accept any new incoming connections. More...
 
std::set< GPackageConnection * > & connections ()
 Returns a reference to the current set of connections. More...
 
void disconnect (GPackageConnection *pConn)
 Disconnect from the specified client. More...
 
virtual void pump (GPackageConnection *pConn)
 Receives any pending messages into an internal buffer (to unblock the client, in case its send buffer is full.) More...
 
char * receive (size_t *pOutLen, GPackageConnection **pOutConn)
 Receives the next available package. (The order and size is guaranteed to arrive the same as when it was sent.) NULL is returned if no package is ready in its entirety. The returned value is a pointer to an internal buffer, the contents of which is only valid until the next time receive is called. More...
 
void send (const char *buf, size_t len, GPackageConnection *pConn)
 Send a package, which guarantees to arrive in the same order and size as it was sent. More...
 
void setMaxBufferSizes (size_t a, size_t b)
 Sets some internal values that guide how it reallocates the internal buffer. 'a' is the maximum buffer size to keep around. 'b' is the maximum size for the buffer ever. If a package bigger than 'b' is sent, an exception will be thrown. If a package bigger than 'a' is sent, then the buffer will be grown to that size, but it will be made small again the next time a package is received. More...
 

Protected Attributes

GDom m_doc
 
- Protected Attributes inherited from GClasses::GPackageServer
unsigned int m_maxBufSize
 
unsigned int m_maxPackageSize
 
SOCKET m_sock
 
std::set< GPackageConnection * > m_socks
 

Additional Inherited Members

- Static Public Member Functions inherited from GClasses::GPackageServer
static void test ()
 Performs unit tests for this class. Throws an exception if there is a failure. More...
 
- Protected Member Functions inherited from GClasses::GPackageServer
virtual GPackageConnectionmakeConnection (SOCKET s)
 This is called just before a new connection is accepted. It returns a pointer to a new GPackageConnection object to associate with this connection. (The connection, however, isn't yet fully established, so it might cause an error if you send something to the client in an overload of this method.) If you want to associate some data with each connection, you can overload this method to create a custom object. More...
 
virtual void onDisconnect (GTCPConnection *pConn)
 This is called when a connection is first known to have disconnected. More...
 
virtual void onReceiveBadData (const char *message)
 This is called when a client sends some bad data. More...
 

Constructor & Destructor Documentation

GClasses::GDomServer::GDomServer ( unsigned int  port)
inline
virtual GClasses::GDomServer::~GDomServer ( )
inlinevirtual

Member Function Documentation

const GDomNode* GClasses::GDomServer::receive ( GPackageConnection **  pOutConn)

Receive the next available DOM node, or NULL if none are ready.

void GClasses::GDomServer::send ( GDomNode pNode,
GPackageConnection pConn 
)

Send the specified DOM node.

Member Data Documentation

GDom GClasses::GDomServer::m_doc
protected