#include <TCPEndpoint.h>
Inheritance diagram for TCPEndpoint:
Public Types | |
enum | statusID { closed, connecting, connected, listening, sending, receiving, closing } |
Public Member Functions | |
TCPEndpoint (int sendBufferSize=8192, int receiveBufferSize=8192) | |
constructor with standard buffer size of 8192 bytes | |
TCPEndpoint (char *address, int port) | |
constructor which opens a connection to address:port * | |
~TCPEndpoint () | |
int | listen (int port) |
listens for incomming connection | |
int | connect (char *address, int port) |
connects to another host | |
int | send (void *Data, int size) |
sends data (data should not be changed until onSendingDone is called) if the data is bigger than sendBufferSize its splittet up and after all data is send onSendingDone is called | |
int | close () |
close the connection | |
virtual void | onConnect (void) |
called by the framwork if the connection is established | |
virtual void | onReceive (void *Data, int size) |
called when data is received | |
virtual void | onClose (int reason) |
called when the connection ist closed by the other host | |
virtual void | onSendingDone (void) |
called after all data from send() ist successfully send | |
const char * | getErrorString (TCPEndpointError error) |
gets a cleartext error string | |
virtual void | listenCont (antEnvMsg *msg) |
called by the processFramework if someone connects to a listen port | |
virtual void | sendCont (antEnvMsg *msg) |
called by the processFramework if data was send. | |
virtual void | receiveCont (antEnvMsg *msg) |
called by the processFramework if new data arrives | |
virtual void | closeCont (antEnvMsg *msg) |
called by the processFreamwork after a close | |
virtual void | connectCont (antEnvMsg *msg) |
called by the processFramework after connecting | |
statusID | getStatus (void) |
Protected Member Functions | |
void | startReceiving () |
internal method which calls the ANT-Library to start receiving | |
Protected Attributes | |
IPAddress | address |
IP-address to connect to. | |
Port | port |
Port to connect to. | |
statusID | status |
status of the connection | |
bool | wasListening |
if true the socket goes back to listening state after disconnection | |
int | sizeOfDataToSend |
size of internal send-buffer | |
void * | sendDataBuffer |
internal send-buffer | |
Private Member Functions | |
void | sendSendMessage (int size) |
Definition at line 17 of file TCPEndpoint.h.
|
Definition at line 20 of file TCPEndpoint.h. Referenced by getStatus(). |
|
constructor with standard buffer size of 8192 bytes
Definition at line 18 of file TCPEndpoint.cpp. References address, closed, status, and wasListening. |
|
constructor which opens a connection to address:port *
Definition at line 27 of file TCPEndpoint.cpp. References connect(). |
Here is the call graph for this function:
|
Definition at line 33 of file TCPEndpoint.cpp. References close(). |
Here is the call graph for this function:
|
listens for incomming connection onConnect is called if the connection is established Definition at line 99 of file TCPEndpoint.cpp. References listening, status, and VERIFY. Referenced by closeCont(). |
|
connects to another host
Definition at line 44 of file TCPEndpoint.cpp. References connecting, and status. Referenced by TCPEndpoint(). |
|
sends data (data should not be changed until onSendingDone is called) if the data is bigger than sendBufferSize its splittet up and after all data is send onSendingDone is called
Definition at line 151 of file TCPEndpoint.cpp. References connected, sendDataBuffer, sendSendMessage(), sizeOfDataToSend, and status. Referenced by TestServer::onConnect(), TestServer::onReceive(), and TCPHandler::sendPackage(). |
Here is the call graph for this function:
|
close the connection
Definition at line 281 of file TCPEndpoint.cpp. References closed, closing, and status. Referenced by TestServer::onReceive(), receiveCont(), sendCont(), and ~TCPEndpoint(). |
|
called by the framwork if the connection is established
Reimplemented in TestServer, and TCPHandler. Definition at line 94 of file TCPEndpoint.cpp. Referenced by connectCont(), and listenCont(). |
|
called when data is received
Reimplemented in TestServer, and TCPHandler. Definition at line 272 of file TCPEndpoint.cpp. Referenced by receiveCont(). |
|
called when the connection ist closed by the other host
Reimplemented in TCPHandler. Definition at line 295 of file TCPEndpoint.cpp. Referenced by receiveCont(). |
|
called after all data from send() ist successfully send
Reimplemented in TCPHandler. Definition at line 228 of file TCPEndpoint.cpp. Referenced by sendCont(). |
|
gets a cleartext error string
Definition at line 318 of file TCPEndpoint.cpp. Referenced by closeCont(), connectCont(), listenCont(), receiveCont(), and sendCont(). |
|
called by the processFramework if someone connects to a listen port
Reimplemented from IPEndpoint. Definition at line 129 of file TCPEndpoint.cpp. References connected, getErrorString(), onConnect(), startReceiving(), status, and wasListening. |
Here is the call graph for this function:
|
called by the processFramework if data was send.
Reimplemented from IPEndpoint. Definition at line 185 of file TCPEndpoint.cpp. References close(), connected, getErrorString(), onSendingDone(), sendDataBuffer, sendSendMessage(), sizeOfDataToSend, and status. |
Here is the call graph for this function:
|
called by the processFramework if new data arrives
Reimplemented from IPEndpoint. Definition at line 244 of file TCPEndpoint.cpp. References close(), connected, getErrorString(), onClose(), onReceive(), startReceiving(), and status. |
Here is the call graph for this function:
|
called by the processFreamwork after a close
Reimplemented from IPEndpoint. Definition at line 300 of file TCPEndpoint.cpp. References closed, getErrorString(), listen(), status, and wasListening. |
Here is the call graph for this function:
|
called by the processFramework after connecting
Reimplemented from IPEndpoint. Definition at line 70 of file TCPEndpoint.cpp. References closed, connected, getErrorString(), onConnect(), startReceiving(), and status. |
Here is the call graph for this function:
|
Definition at line 55 of file TCPEndpoint.h. |
|
internal method which calls the ANT-Library to start receiving
Definition at line 234 of file TCPEndpoint.cpp. References connected, and status. Referenced by connectCont(), listenCont(), and receiveCont(). |
|
Definition at line 220 of file TCPEndpoint.cpp. References status. Referenced by send(), and sendCont(). |
|
IP-address to connect to.
Definition at line 60 of file TCPEndpoint.h. Referenced by TCPEndpoint(). |
|
Port to connect to.
Definition at line 61 of file TCPEndpoint.h. |
|
status of the connection
Definition at line 62 of file TCPEndpoint.h. Referenced by close(), closeCont(), connect(), connectCont(), getStatus(), listen(), listenCont(), receiveCont(), send(), sendCont(), sendSendMessage(), startReceiving(), and TCPEndpoint(). |
|
if true the socket goes back to listening state after disconnection
Definition at line 64 of file TCPEndpoint.h. Referenced by closeCont(), listenCont(), and TCPEndpoint(). |
|
size of internal send-buffer
Definition at line 65 of file TCPEndpoint.h. Referenced by send(), and sendCont(). |
|
internal send-buffer
Definition at line 66 of file TCPEndpoint.h. Referenced by send(), and sendCont(). |