Purple Code

com.purpletech.message
Class PingBot

java.lang.Object
  |
  +--com.purpletech.message.PingBot
All Implemented Interfaces:
MessageListener, java.lang.Runnable

public class PingBot
extends java.lang.Object
implements MessageListener, java.lang.Runnable

Runs N ping bots. They constantly spew Pings and keep track of the results.

OptionDescriptionDefault
-n number of clients to spawn 1
-h host to connect to 127.0.0.1
-p port 12345
-d delay between pings (msec) 1000
-c total number of times to ping per client (-1 = infinite) -1

Version:
1.0
Author:
Alex

Field Summary
 int received
           
 int sent
           
 
Constructor Summary
PingBot(java.lang.String host, int port, int delay, int c, int av, boolean isVerbose, Average avgGlobal)
          Initialize this object.
 
Method Summary
 Average getAverage()
           
 int getPendingPings()
           
static void main(java.lang.String[] args)
           
 void messageArrived(MessageEvent event)
           
 void run()
           
 void sendPings()
           
 void sendPings(int c)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sent

public int sent

received

public int received
Constructor Detail

PingBot

public PingBot(java.lang.String host,
               int port,
               int delay,
               int c,
               int av,
               boolean isVerbose,
               Average avgGlobal)
Initialize this object.

Parameters:
c - number of pings per client (-1 = infinite)
av - how long of a running average to maintain
isVerbose - should we print out whenever we receive a ping
avgGlobal - if non-null, use it instead of making our own average
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

getPendingPings

public int getPendingPings()

getAverage

public Average getAverage()

sendPings

public void sendPings()

sendPings

public void sendPings(int c)
Parameters:
c - number of Pings to send (-1 = infinite)

messageArrived

public void messageArrived(MessageEvent event)
Specified by:
messageArrived in interface MessageListener

main

public static void main(java.lang.String[] args)

Documentation generated March 5 2003