Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

TCPHandler Class Reference

The associated sender first finds out the size of the data to send and streams the data into a memory buffer. More...

#include <TCPHandler.h>

Inheritance diagram for TCPHandler:

Inheritance graph
[legend]
Collaboration diagram for TCPHandler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TCPHandler ()
 TCPHandler (NetSenderBase &theSender, NetReceiverBase &theReceiver)
void setTransmitters (NetSenderBase &theSender, NetReceiverBase &theReceiver)
virtual void onReceive (void *someData, int size)
 receives size, collects all data and calls the receiver after that

virtual void onConnect (void)
 sets sender active after the connection is established

virtual void onClose (int reason)
 sets sender inactive after disconnecting

virtual void onSendingDone (void)
 informs the sender that it can send again

virtual void sendPackage (int senderNumber, void *someData, int size)
 called by the sender to send data


Private Attributes

NetReceiverBasereceiver
 the associated receiver

NetSenderBasesender
 the assiciated sender

void * receiveBuffer
 buffer where the data is stored until completly collected

int sizeOfDataToRead
 size of this data

bool sendingDone

Detailed Description

The associated sender first finds out the size of the data to send and streams the data into a memory buffer.

After that the sender calls sendPackage in the TCPHandler and the TCPHandler takes care of sending the data to the other host.

the TCPHandler first sends the size of the data and after that the data itself.

If there is incomining data the TCPHandler first reads the size of the incoming Data and after that all received data is collected in a memory buffer until it is complete. Now the associated receiver is called to stream the data from the buffer.

Definition at line 33 of file TCPHandler.h.


Constructor & Destructor Documentation

TCPHandler::TCPHandler  )  [inline]
 

Definition at line 36 of file TCPHandler.h.

TCPHandler::TCPHandler NetSenderBase theSender,
NetReceiverBase theReceiver
 

Definition at line 17 of file TCPHandler.cpp.

References NetReceiverBase::getPackage(), NetSenderBase::getPackage(), sender, sendingDone, NetSenderBase::setHandler(), and sizeOfDataToRead.

Here is the call graph for this function:


Member Function Documentation

void TCPHandler::setTransmitters NetSenderBase theSender,
NetReceiverBase theReceiver
 

Definition at line 31 of file TCPHandler.cpp.

References sender, and NetSenderBase::setHandler().

Here is the call graph for this function:

void TCPHandler::onReceive void *  someData,
int  size
[virtual]
 

receives size, collects all data and calls the receiver after that

Reimplemented from TCPEndpoint.

Definition at line 38 of file TCPHandler.cpp.

References ASSERT, NetReceiverBase::getPackage(), NetReceiverBase::onReceive(), and sizeOfDataToRead.

Here is the call graph for this function:

void TCPHandler::onConnect void   )  [virtual]
 

sets sender active after the connection is established

Reimplemented from TCPEndpoint.

Definition at line 104 of file TCPHandler.cpp.

References NetSenderBase::sendDone(), sender, sendingDone, and sizeOfDataToRead.

Here is the call graph for this function:

void TCPHandler::onClose int  reason  )  [virtual]
 

sets sender inactive after disconnecting

Reimplemented from TCPEndpoint.

Definition at line 112 of file TCPHandler.cpp.

void TCPHandler::onSendingDone void   )  [virtual]
 

informs the sender that it can send again

Reimplemented from TCPEndpoint.

Definition at line 118 of file TCPHandler.cpp.

References NetSenderBase::sendDone(), sender, and sendingDone.

Here is the call graph for this function:

void TCPHandler::sendPackage int  senderNumber,
void *  someData,
int  size
[virtual]
 

called by the sender to send data

Reimplemented from NetHandler.

Definition at line 124 of file TCPHandler.cpp.

References TCPEndpoint::send(), and sendingDone.

Here is the call graph for this function:


Member Data Documentation

NetReceiverBase* TCPHandler::receiver [private]
 

the associated receiver

Definition at line 46 of file TCPHandler.h.

NetSenderBase* TCPHandler::sender [private]
 

the assiciated sender

Definition at line 47 of file TCPHandler.h.

Referenced by onConnect(), onSendingDone(), setTransmitters(), and TCPHandler().

void* TCPHandler::receiveBuffer [private]
 

buffer where the data is stored until completly collected

Reimplemented from IPEndpoint.

Definition at line 49 of file TCPHandler.h.

int TCPHandler::sizeOfDataToRead [private]
 

size of this data

Definition at line 50 of file TCPHandler.h.

Referenced by onConnect(), onReceive(), and TCPHandler().

bool TCPHandler::sendingDone [private]
 

Definition at line 51 of file TCPHandler.h.

Referenced by onConnect(), onSendingDone(), sendPackage(), and TCPHandler().


The documentation for this class was generated from the following files:
Generated on Thu Sep 23 20:11:59 2004 for GT2004 by doxygen 1.3.6