aboutsummaryrefslogtreecommitdiff
path: root/src/Probe.java
diff options
context:
space:
mode:
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);