aboutsummaryrefslogtreecommitdiff
path: root/src/Probe.java
diff options
context:
space:
mode:
authorjestin2006-07-24 13:33:15 +0000
committerjestin2006-07-24 13:33:15 +0000
commitf0ca4915ee9eec18d05c60e3cf0248b50fab7310 (patch)
tree94697724e5fffa4aef5eefc3a98db5276f7e5d95 /src/Probe.java
parent0f83d1bab49eb913cc8be048ec7884a9a2e3402e (diff)
downloadivy-java-f0ca4915ee9eec18d05c60e3cf0248b50fab7310.zip
ivy-java-f0ca4915ee9eec18d05c60e3cf0248b50fab7310.tar.gz
ivy-java-f0ca4915ee9eec18d05c60e3cf0248b50fab7310.tar.bz2
ivy-java-f0ca4915ee9eec18d05c60e3cf0248b50fab7310.tar.xz
adding ping and pong
Diffstat (limited to 'src/Probe.java')
-rw-r--r--src/Probe.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Probe.java b/src/Probe.java
index 0d3eed7..8ced8e5 100644
--- a/src/Probe.java
+++ b/src/Probe.java
@@ -7,6 +7,8 @@
* (c) CENA
*
* Changelog:
+ * 1.2.12
+ * - .ping is back
* 1.2.9
* - added the .time command
* - added the .bound *
@@ -71,7 +73,8 @@ public class Probe implements IvyApplicationListener, IvyMessageListener, IvyBin
".bound CLIENT\t\t\t* lists the subscriptions of a client, .bound * to get all\n"+
".bound\t\t\t\t* lists the probe's subscriptions\n"+
".where CLIENT\t\t\t* displays the host where a client runs\n"+
- ".time COUNT MESSAGE\t\t\t* measures the time it takes to send COUNT messages\n"
+ ".time COUNT MESSAGE\t\t\t* measures the time it takes to send COUNT messages\n"+
+ ".ping CLIENT\t\t\t* measures the roundtrip time in millisecond to reach a client\n"
;
public static final String helpmsg =
@@ -274,6 +277,21 @@ public class Probe implements IvyApplicationListener, IvyMessageListener, IvyBin
for (int i=0;i<v.size();i++) {
println("-> "+((IvyClient)v.elementAt(i)).getApplicationName());
}
+ } else if ( s.lastIndexOf(".ping ")>=0) {
+ String target=s.substring(6);
+ Vector v=bus.getIvyClientsByName(target);
+ if (v.size()==0) println("no Ivy client with the name \""+target+"\"");
+ for (int i=0;i<v.size();i++) {
+ try {
+ ((IvyClient)v.elementAt(i)).ping(new PingCallback() {
+ public void pongReceived(IvyClient ic,int elapsedTime){
+ System.out.println("round trip to"+ic.getApplicationName()+" "+elapsedTime+" ms");
+ }
+ });
+ } catch (IvyException ie) {
+ println("-> ping not sent, the remote client must have disconnected");
+ }
+ }
} else if ( s.lastIndexOf(".where ")>=0) {
String target=s.substring(7);
Vector v=bus.getIvyClientsByName(target);