Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

QUANTAnet_parallelTcpServer_c Class Reference

#include <QUANTAnet_parallelTcp_c.hxx>

Inheritance diagram for QUANTAnet_parallelTcpServer_c:

QUANTAnet_socketbase_c QUANTAnet_extendedParallelTcpServer_c List of all members.

Detailed Description

If you are writing a server you need to instantiate a QUANTAnet_parallelTcpServer_c object.

Likewise if you are writing a client you need to instantiate a QUANTAnet_parallelTcpClient_c object.

Server setup: First, instantiate the QUANTAnet_parallelTcpServer_c class. Then call this object's init() method with the desired port number as parameter. After this, we call QUANTAnet_parallelTcpServer_c::checkForNewConnections(PortNumber). This is a blocking call that waits for the client to make a QUANTAnet_parallelTcpClient_c::connectToServer() call. checkForNewConnections() returns a pointer to a QUANTAnet_parallelTcpClient_c object, which you can use to communicate with the client. Note that you do not explicitly instantiate a QUANTAnet_parallelTcpClient_c object when you are using the server class. You can just declare a pointer to the client object and assign to this variable the return value of QUANTAnet_parallelTcpServer_c::checkForNewConnections function.

Client setup: We instantiate the QUANTAnet_parallelTcpClient_c class and call the QUANTAnet_parallelTcpClient_c::connectToServer(MachineName,PortNumber,NumberOfSockets) method. We then use this object to do a write and read.


Public Member Functions

int init (int port)
 Open the server on a port.
void close ()
 Close the server port.
QUANTAnet_parallelTcpClient_ccheckForNewConnections ()
 Check to see if there is a request from clients for connection.
int getSelfPort ()
 Get port of self.
unsigned int getTotalDataSent ()
 Get the total data sent by a connection.
unsigned int getTotalDataRead ()
 Get total data received by a connection.
double getInstantReceiveBandwidth ()
 Get total instantaneous incoming bandwidth by a connection.
double getInstantSendBandwidth ()
 Get total instantaneous outgoing bandwidth by a connection.
double getAverageReceiveBandwidth ()
 Get average incoming bandwidth by a connection.
double getAverageSendBandwidth ()
 Get average outgoing bandwidth by a connection.
void setInstantLatency (double lat)
 Set the instantaneous latency and also calculate the STALatency and Jitter values automatically.
double getInstantLatency ()
 Retrieve most recent incoming packet's latency.
double getAverageLatency ()
 Retrieve average incoming latency.
double getMaxLatency ()
 Retrieve max latency so far.
double getMinLatency ()
 Retrieve min latency so far.
void incrementDataSent (unsigned long size)
 Record amount of data sent.
void incrementDataRead (unsigned long size)
 Record amount of data read - and also compute instantaneous, average bandwidths along with the inter message delay values.
double getInstantInterMesgDelay ()
 Get instantaneous inter-message delay (jitter).
double getMaxInterMesgDelay ()
 Get max inter-message delay (jitter).
double getMinInterMesgDelay ()
 Get min inter-message delay (jitter).
double getAverageInterMesgDelay ()
 Get average inter-message delay (jitter).
double getSTABandwidth ()
 Get the Short Term Average Bandwidth -over a fixed number of packets (defined by BANDWIDTH_BUF_SIZE).
double getSTALatency ()
 Get the Short Term Average Latency -over a number of packets (defined by LATENCY_BUF_SIZE).
double getBurstiness ()
 get the burstinesss
double getJitter ()
 Get the Jitter.
unsigned long getPacketsRead ()
 Return the total number of packets read.
unsigned long getPacketsSent ()
 Return the total number of packets sent.
virtual int getSocketId ()
 Returns the socket id.

Static Public Member Functions

int hostnameToIP (const char *hostname, char *hostIP)
 Convert a hostname to an ip address of xxx.xxx.xxx.xxx.
void ipNumToString (unsigned int ip, char *ipstring)
 Convert ip address to a string of xxx.xxx.xxx.xxx.
double getTimeInSecs ()
 Get time in secs with microsecond accuracy.
void getHostName (char *name, int len)
 Get the full host name of a local client.
void expandHostName (const char *src, char *newname, int len)
 If hostname is not fully expanded (ie does not include its domain) then expand it.
long getSelfIP ()
 Get the host IP address as a long integer.
void getSelfIP (char *)
 Get the host IP address as a character string.
int selectSock (void *ptr, int *status, int numSocks, struct timeval *timeout)
 Returns the status of the sockets being polled.

Protected Member Functions

void computeInstantSendBandwidth ()
 Calculate the instantaneous outgoing bandwidth.
void computeInstantReceiveBandwidth ()
 Calculate the instantaneous incoming bandwidth.
void computeAverageReceiveBandwidth ()
 Calculate the average incoming bandwidth.
void computeAverageSendBandwidth ()
 Calculate the average outgoing bandwidth.
void calculateJitter (double lat)
 Calculate the jitter over a specified number of packets.
void calculateBurstiness (double bw)
 Calculate the burstiness over a specified number of packets.


Member Function Documentation

QUANTAnet_parallelTcpClient_c* QUANTAnet_parallelTcpServer_c::checkForNewConnections  ) 
 

Check to see if there is a request from clients for connection.

If yes then return a QUANTAnet_parallelTcpClient_c object which you can then use to talk to the client.

See also:
QUANTAnet_parallelTcpClient_c class.

Reimplemented in QUANTAnet_extendedParallelTcpServer_c.

int QUANTAnet_parallelTcpServer_c::init int  port  ) 
 

Open the server on a port.

Typically after this call you sit in a loop and call checkForNewConnections to wait for incoming connections.

Returns:
FAILED if failed, OK if success


The documentation for this class was generated from the following file:
Generated on Tue Jun 6 16:06:26 2006 for QUANTA by doxygen 1.3.8