cmlabs::NetworkConnection Class Reference

#include <NetworkConnection.h>

Inheritance diagram for cmlabs::NetworkConnection:

Inheritance graph
[legend]
Collaboration diagram for cmlabs::NetworkConnection:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 NetworkConnection (JSocket *con, NetProtocol *netProtocol, TCPReceiver *rec)
 Constructor with an existing socket.
 NetworkConnection (const TCPLocation &loc, NetProtocol *netProtocol, TCPReceiver *rec)
 Constructor to connect to a remote server.
 NetworkConnection (const JString &addr, int port, NetProtocol *netProtocol, TCPReceiver *rec)
 Constructor to connect to a remote server.
bool restart (JSocket *con, NetProtocol *netProtocol, TCPReceiver *rec)
 Restarting... almost constructor...
bool restart (const TCPLocation &loc, NetProtocol *netProtocol, TCPReceiver *rec)
 Restarting... almost constructor...
bool restart (const JString &addr, int port, NetProtocol *netProtocol, TCPReceiver *rec)
 Restarting... almost constructor...
virtual ~NetworkConnection ()
Objectclone () const
JString getLocalHostname ()
JString getLocalIPAddress ()
JString getRemoteHostname ()
TCPLocation getRemoteLocation ()
TCPLocation getLastConnectedTo ()
bool unitTest ()
void init (TCPReceiver *rec)
bool initializeAsReceiver (TCPReceiver *rec)
void run ()
bool terminate ()
bool isErrorRecoverable ()
bool isConnected ()
bool isConnectedTo (const TCPLocation &loc)
bool isConnectedTo (const JString &name)
bool isPersistent ()
bool hasTerminated ()
bool isReset ()
bool isBroken ()
int read (char *buffer, int maxcount, long timeout)
JString readString (unsigned int numBytes, unsigned int msTimeout)
JString readln (unsigned int msTimeout)
bool write (char *buffer, int length)
bool writeString (const JString &str)
bool writeln (const JString &str)
MessagesendReceiveObject (Message *msg, unsigned int msTimeout)
MessagereceiveObject (unsigned int msTimeout)
bool sendObject (Message *msg, bool isReply)
bool sendObjectWhenReady (Message *msg, int timeout=3000)
double getSendProgress ()
double getReceiveProgress ()
long msSinceLastRead ()
long msSinceLastWrite ()
long msSinceLastActivity ()
bool hasNoParent ()
bool reset ()
JString print ()
bool isReceiver ()
bool isLocalCallback ()
bool isRemoteCallback ()
bool isIncomingConnection ()
bool setKeepAliveTimeout (long timeout)
long getKeepAliveTimeout ()
bool useKeepAlive (bool doKeepAlive)
bool sendKeepAlive ()
bool ping (const JString &from, const JString &to, int timeout=5000)
bool trainNetworkProfile ()
bool trainNetworkProfile (ConnectionProfile *profile)
MessageperformBenchmark (Message *msg)
long pingRemotePeer ()
long uploadServerTest (long size)
long downloadServerTest (long size)
bool sendLocalProfile ()
bool getRemoteProfile ()
bool allowMessageDropping (bool allow)

Public Attributes

bool shouldContinue
bool isDoneRunning
bool isTerminated
long timeout
Networkparent
TCPReceiverreceiver
NetProtocolnetprotocol
JString conID
JString remoteName
bool createdAsReceiver
HTTPRequestrecHTTP
ConnectionProfile localProfile
ConnectionProfile remoteProfile

Private Member Functions

void resetBuffer ()

Private Attributes

int count
JSocketmySocket
JMutex conMutex
bool passive
JTime lastRead
JTime lastWrite
long keepAliveTimeout
TCPLocation lastConnectedTo
ObjectQueue receivedMessages
ObjectQueue toSendMessages
JSemaphore toSendSemaphore
int toSendMaxQueueSize
bool allowMessageDrop


Detailed Description

Definition at line 56 of file NetworkConnection.h.


Constructor & Destructor Documentation

cmlabs::NetworkConnection::NetworkConnection ( JSocket con,
NetProtocol netProtocol,
TCPReceiver rec 
)

Constructor with an existing socket.

Definition at line 33 of file NetworkConnection.cpp.

cmlabs::NetworkConnection::NetworkConnection ( const TCPLocation loc,
NetProtocol netProtocol,
TCPReceiver rec 
)

Constructor to connect to a remote server.

Definition at line 46 of file NetworkConnection.cpp.

cmlabs::NetworkConnection::NetworkConnection ( const JString addr,
int  port,
NetProtocol netProtocol,
TCPReceiver rec 
)

Constructor to connect to a remote server.

Definition at line 61 of file NetworkConnection.cpp.

cmlabs::NetworkConnection::~NetworkConnection (  )  [virtual]

Definition at line 75 of file NetworkConnection.cpp.


Member Function Documentation

bool cmlabs::NetworkConnection::restart ( JSocket con,
NetProtocol netProtocol,
TCPReceiver rec 
)

Restarting... almost constructor...

Definition at line 98 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::restart ( const TCPLocation loc,
NetProtocol netProtocol,
TCPReceiver rec 
)

Restarting... almost constructor...

Definition at line 120 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::restart ( const JString addr,
int  port,
NetProtocol netProtocol,
TCPReceiver rec 
)

Restarting... almost constructor...

Definition at line 149 of file NetworkConnection.cpp.

Object* cmlabs::NetworkConnection::clone (  )  const [virtual]

Implements cmlabs::Object.

Definition at line 79 of file NetworkConnection.h.

JString cmlabs::NetworkConnection::getLocalHostname (  ) 

Definition at line 878 of file NetworkConnection.cpp.

JString cmlabs::NetworkConnection::getLocalIPAddress (  ) 

Definition at line 894 of file NetworkConnection.cpp.

JString cmlabs::NetworkConnection::getRemoteHostname (  ) 

Definition at line 910 of file NetworkConnection.cpp.

TCPLocation cmlabs::NetworkConnection::getRemoteLocation (  ) 

Definition at line 925 of file NetworkConnection.cpp.

TCPLocation cmlabs::NetworkConnection::getLastConnectedTo (  ) 

Definition at line 921 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::unitTest (  ) 

Reimplemented from cmlabs::JThread.

Definition at line 535 of file NetworkConnection.cpp.

void cmlabs::NetworkConnection::init ( TCPReceiver rec  ) 

Definition at line 182 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::initializeAsReceiver ( TCPReceiver rec  ) 

Definition at line 223 of file NetworkConnection.cpp.

void cmlabs::NetworkConnection::run (  )  [virtual]

Reimplemented from cmlabs::JThread.

Definition at line 237 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::terminate (  ) 

Reimplemented from cmlabs::JThread.

Definition at line 386 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isErrorRecoverable (  ) 

Definition at line 933 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isConnected (  ) 

Definition at line 813 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isConnectedTo ( const TCPLocation loc  ) 

Definition at line 855 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isConnectedTo ( const JString name  ) 

Definition at line 859 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isPersistent (  ) 

Definition at line 870 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::hasTerminated (  ) 

Definition at line 941 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isReset (  ) 

Definition at line 970 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isBroken (  ) 

Definition at line 974 of file NetworkConnection.cpp.

int cmlabs::NetworkConnection::read ( char *  buffer,
int  maxcount,
long  timeout 
)

Definition at line 731 of file NetworkConnection.cpp.

JString cmlabs::NetworkConnection::readString ( unsigned int  numBytes,
unsigned int  msTimeout 
)

Definition at line 748 of file NetworkConnection.cpp.

JString cmlabs::NetworkConnection::readln ( unsigned int  msTimeout  ) 

Definition at line 761 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::write ( char *  buffer,
int  length 
)

Definition at line 774 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::writeString ( const JString str  ) 

Definition at line 787 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::writeln ( const JString str  ) 

Definition at line 800 of file NetworkConnection.cpp.

Message * cmlabs::NetworkConnection::sendReceiveObject ( Message msg,
unsigned int  msTimeout 
)

Definition at line 549 of file NetworkConnection.cpp.

Message * cmlabs::NetworkConnection::receiveObject ( unsigned int  msTimeout  ) 

Definition at line 638 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::sendObject ( Message msg,
bool  isReply 
)

Definition at line 685 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::sendObjectWhenReady ( Message msg,
int  timeout = 3000 
)

Definition at line 715 of file NetworkConnection.cpp.

double cmlabs::NetworkConnection::getSendProgress (  ) 

Definition at line 978 of file NetworkConnection.cpp.

double cmlabs::NetworkConnection::getReceiveProgress (  ) 

Definition at line 985 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::msSinceLastRead (  ) 

Definition at line 946 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::msSinceLastWrite (  ) 

Definition at line 952 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::msSinceLastActivity (  ) 

Definition at line 958 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::hasNoParent (  ) 

Definition at line 965 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::reset (  ) 

Definition at line 412 of file NetworkConnection.cpp.

JString cmlabs::NetworkConnection::print (  )  [virtual]

Reimplemented from cmlabs::Object.

Definition at line 495 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isReceiver (  ) 

Definition at line 529 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isLocalCallback (  ) 

Definition at line 476 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isRemoteCallback (  ) 

Definition at line 482 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::isIncomingConnection (  ) 

Definition at line 488 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::setKeepAliveTimeout ( long  timeout  ) 

Definition at line 993 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::getKeepAliveTimeout (  ) 

Definition at line 998 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::useKeepAlive ( bool  doKeepAlive  ) 

Definition at line 1002 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::sendKeepAlive (  ) 

Definition at line 1031 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::ping ( const JString from,
const JString to,
int  timeout = 5000 
)

Definition at line 1010 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::trainNetworkProfile (  ) 

Definition at line 1058 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::trainNetworkProfile ( ConnectionProfile profile  ) 

Definition at line 1062 of file NetworkConnection.cpp.

Message * cmlabs::NetworkConnection::performBenchmark ( Message msg  ) 

Definition at line 1158 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::pingRemotePeer (  ) 

Definition at line 1247 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::uploadServerTest ( long  size  ) 

Definition at line 1272 of file NetworkConnection.cpp.

long cmlabs::NetworkConnection::downloadServerTest ( long  size  ) 

Definition at line 1294 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::sendLocalProfile (  ) 

Definition at line 1208 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::getRemoteProfile (  ) 

Definition at line 1225 of file NetworkConnection.cpp.

bool cmlabs::NetworkConnection::allowMessageDropping ( bool  allow  ) 

Definition at line 710 of file NetworkConnection.cpp.

void cmlabs::NetworkConnection::resetBuffer (  )  [private]


Member Data Documentation

Definition at line 120 of file NetworkConnection.h.

Definition at line 121 of file NetworkConnection.h.

Definition at line 122 of file NetworkConnection.h.

Definition at line 123 of file NetworkConnection.h.

Definition at line 153 of file NetworkConnection.h.

Definition at line 155 of file NetworkConnection.h.

Definition at line 156 of file NetworkConnection.h.

Definition at line 157 of file NetworkConnection.h.

Definition at line 158 of file NetworkConnection.h.

Definition at line 159 of file NetworkConnection.h.

Definition at line 161 of file NetworkConnection.h.

Definition at line 163 of file NetworkConnection.h.

Definition at line 164 of file NetworkConnection.h.

Definition at line 167 of file NetworkConnection.h.

Definition at line 169 of file NetworkConnection.h.

Definition at line 170 of file NetworkConnection.h.

Definition at line 172 of file NetworkConnection.h.

Definition at line 174 of file NetworkConnection.h.

Definition at line 175 of file NetworkConnection.h.

Definition at line 176 of file NetworkConnection.h.

Definition at line 177 of file NetworkConnection.h.

Definition at line 178 of file NetworkConnection.h.

Definition at line 179 of file NetworkConnection.h.

Definition at line 180 of file NetworkConnection.h.

Definition at line 181 of file NetworkConnection.h.

Definition at line 182 of file NetworkConnection.h.


The documentation for this class was generated from the following files:

Generated on Tue Jul 7 16:23:36 2009 for CoreLibrary by  doxygen 1.5.6