TCP Reflector


Introduction            Like a UDP reflector, it is often useful to have a TCP reflector. QUANTA classes can be used to reflect TCP streams to multiple connected clients. This demo shows how a remote client may visualize network performance in real time.

QUANTA classes used

    QUANTAnet_tcpReflector_c

                An object of this class can be set up as the server. Use init() to initialize it. The methods checkForNewClients() and process() when called continuously will look out for incoming clients and process them. The showStats() method can provide the performance monitoring data. Use setForcedDestination() to reflect to a single address and port, otherwise sendToAll() will send data to all clients attached to the reflector.

    QUANTAnet_tcpReflectorClient_c

                It is recommended that clients created using this class be used to connect to the reflector. Use the method connectToServer(). After this you can perform read() or write() operations with teh blocking or non blocking mode. Use showStatus() to find out the status of the connection.

                The tcpreflector.cxx program sets up the reflector. Set up multiple clients using  tcpreflectorclient.cxx . The clients connect to the server and send text to it. The netlogd.cxx and perfclient.cxx programs implement a simple performance monitoring daemon and client program. It uses QUANTAnet_perfDaemon_c and QUANTAnet_perfDaemonClient_c classes.


Usage

     1.To run the tcpreflector on one machine (say evans)
              tcpreflector
     2. Optionally for network stats, run the netlog daemon (say cray)
              netlogd
     3.To run a client on a separate machine
              tcpreflectorclient evans cray
     4.To run another client on another machine
              tcpreflectorclient evans cray
     5. Now to watch performance stats, invoke another client with netlogd server
              perfclient cray

Output

         The tcpreflector by default reflects packets to all tcpreflectorclients connected except the one that sends the package -so thats why you would
have to run two clients with the reflector  This demo also illustrates the sendStats API that sends the network performance statistics to netlogd -a perfDaemon(which in turn reflects the package to a perfclient).


for more information: Post your questions online on the Quanta forum page.