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

UDPEndpoint Class Reference

Handles sending and receiving UDP-Packages. More...

#include <UDPEndpoint.h>

Inheritance diagram for UDPEndpoint:

Inheritance graph
[legend]
Collaboration diagram for UDPEndpoint:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 UDPEndpoint (int sendBufferSize=2048, int receiveBufferSize=2048)
 ~UDPEndpoint ()
int bind (int listenPort)
 binds endpoint to listen to port

int bind (int listenPort, char *address, int sendPort)
 binds endpoint to listen to port and sets receiving host to address:port

int bind (Port listenPort, IPAddress address, Port sendPort)
int send (int size)
 sends data from the shared buffer (does no copy of data and assumes that the Data is in sharedSendBuffer

int send (int size, char *addr, int sPort)
 sends data from the shared buffer to a givern host/port

int send (void *data, int size)
 sends data to last specified other host (copies the data)

int send (void *data, int size, char *address, int port)
 sends data to other host

int send (void *data, int size, IPAddress address, int port)
 sends data to other host

virtual void onReceive (void *data, int size)
 Called when new data arrives.

virtual void onClose ()
 Called from close() when connection closes.

virtual void onSendingDone ()
void close ()
 Closes Endpoint in case of an error.

const char * getErrorString (UDPEndpointError error)
 gets errorString of error

const char * getErrorString ()
 gets errorString of last error

virtual void sendCont (antEnvMsg *msg)
 called by the framwork is sending is done

virtual void receiveCont (antEnvMsg *msg)
 called by the framweok if there is new data

virtual void closeCont (antEnvMsg *msg)
 does cleanup-stuff


Protected Attributes

IPAddress ipOfLastPackage
 Ip of the last package recieved.


Private Member Functions

void startReceiving ()

Private Attributes

IPAddress address
 IP address to send the data to.

Port sendPort
 port to send the data to

Port listenPort
 port to listen for data


Detailed Description

Handles sending and receiving UDP-Packages.

Definition at line 17 of file UDPEndpoint.h.


Constructor & Destructor Documentation

UDPEndpoint::UDPEndpoint int  sendBufferSize = 2048,
int  receiveBufferSize = 2048
 

Definition at line 16 of file UDPEndpoint.cpp.

UDPEndpoint::~UDPEndpoint  ) 
 

Definition at line 33 of file UDPEndpoint.cpp.

References close().

Here is the call graph for this function:


Member Function Documentation

int UDPEndpoint::bind int  listenPort  ) 
 

binds endpoint to listen to port

Definition at line 39 of file UDPEndpoint.cpp.

References getErrorString(), listenPort, and startReceiving().

Referenced by bind(), DDPHandler::initDDPHandler(), and UDPHandler::start().

Here is the call graph for this function:

int UDPEndpoint::bind int  listenPort,
char *  address,
int  sendPort
 

binds endpoint to listen to port and sets receiving host to address:port

Definition at line 65 of file UDPEndpoint.cpp.

References bind(), and sendPort.

Here is the call graph for this function:

int UDPEndpoint::bind Port  listenPort,
IPAddress  address,
Port  sendPort
 

Definition at line 56 of file UDPEndpoint.cpp.

References bind(), and sendPort.

Here is the call graph for this function:

int UDPEndpoint::send int  size  ) 
 

sends data from the shared buffer (does no copy of data and assumes that the Data is in sharedSendBuffer

Definition at line 82 of file UDPEndpoint.cpp.

References sendPort.

Referenced by send(), DDPHandler::sendDDPPackage(), and UDPHandlerEndpoint::sendPackage().

int UDPEndpoint::send int  size,
char *  addr,
int  sPort
 

sends data from the shared buffer to a givern host/port

Definition at line 90 of file UDPEndpoint.cpp.

References send(), and sendPort.

Here is the call graph for this function:

int UDPEndpoint::send void *  data,
int  size
 

sends data to last specified other host (copies the data)

Definition at line 74 of file UDPEndpoint.cpp.

References send().

Here is the call graph for this function:

int UDPEndpoint::send void *  data,
int  size,
char *  address,
int  port
 

sends data to other host

Definition at line 99 of file UDPEndpoint.cpp.

References send(), and sendPort.

Here is the call graph for this function:

int UDPEndpoint::send void *  data,
int  size,
IPAddress  address,
int  port
 

sends data to other host

Definition at line 107 of file UDPEndpoint.cpp.

References send(), and sendPort.

Here is the call graph for this function:

void UDPEndpoint::onReceive void *  data,
int  size
[virtual]
 

Called when new data arrives.

Reimplemented in DDPHandler, and UDPHandlerEndpoint.

Definition at line 134 of file UDPEndpoint.cpp.

Referenced by receiveCont().

void UDPEndpoint::onClose  )  [virtual]
 

Called from close() when connection closes.

Definition at line 173 of file UDPEndpoint.cpp.

Referenced by close().

void UDPEndpoint::onSendingDone  )  [virtual]
 

Reimplemented in UDPHandlerEndpoint.

Definition at line 130 of file UDPEndpoint.cpp.

Referenced by sendCont().

void UDPEndpoint::close  ) 
 

Closes Endpoint in case of an error.

Definition at line 164 of file UDPEndpoint.cpp.

References onClose().

Referenced by ~UDPEndpoint().

Here is the call graph for this function:

const char * UDPEndpoint::getErrorString UDPEndpointError  error  ) 
 

gets errorString of error

Definition at line 184 of file UDPEndpoint.cpp.

const char* UDPEndpoint::getErrorString  ) 
 

gets errorString of last error

Referenced by bind(), receiveCont(), and sendCont().

void UDPEndpoint::sendCont antEnvMsg *  msg  )  [virtual]
 

called by the framwork is sending is done

Reimplemented from IPEndpoint.

Definition at line 115 of file UDPEndpoint.cpp.

References getErrorString(), and onSendingDone().

Here is the call graph for this function:

void UDPEndpoint::receiveCont antEnvMsg *  msg  )  [virtual]
 

called by the framweok if there is new data

Actually calls onReceive()

Reimplemented from IPEndpoint.

Definition at line 149 of file UDPEndpoint.cpp.

References getErrorString(), ipOfLastPackage, onReceive(), and startReceiving().

Here is the call graph for this function:

void UDPEndpoint::closeCont antEnvMsg *  msg  )  [virtual]
 

does cleanup-stuff

Reimplemented from IPEndpoint.

Definition at line 177 of file UDPEndpoint.cpp.

void UDPEndpoint::startReceiving  )  [private]
 

Definition at line 140 of file UDPEndpoint.cpp.

Referenced by bind(), and receiveCont().


Member Data Documentation

IPAddress UDPEndpoint::ipOfLastPackage [protected]
 

Ip of the last package recieved.

Definition at line 65 of file UDPEndpoint.h.

Referenced by receiveCont().

IPAddress UDPEndpoint::address [private]
 

IP address to send the data to.

Definition at line 68 of file UDPEndpoint.h.

Port UDPEndpoint::sendPort [private]
 

port to send the data to

Definition at line 69 of file UDPEndpoint.h.

Referenced by bind(), and send().

Port UDPEndpoint::listenPort [private]
 

port to listen for data

Definition at line 70 of file UDPEndpoint.h.

Referenced by bind().


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