ndt-dev - [ndt-dev] [ndt] r386 committed - Added API functions for new HTML5-based NDT client functionality.
Subject: NDT-DEV email list created
List archive
[ndt-dev] [ndt] r386 committed - Added API functions for new HTML5-based NDT client functionality.
Chronological Thread
- From:
- To:
- Subject: [ndt-dev] [ndt] r386 committed - Added API functions for new HTML5-based NDT client functionality.
- Date: Fri, 18 Mar 2011 14:44:29 +0000
Revision: 386
Author:
Date: Fri Mar 18 07:44:13 2011
Log: Added API functions for new HTML5-based NDT client functionality.
http://code.google.com/p/ndt/source/detail?r=386
Modified:
/trunk/Applet/Tcpbw100.java
=======================================
--- /trunk/Applet/Tcpbw100.java Tue Sep 28 15:06:38 2010
+++ /trunk/Applet/Tcpbw100.java Fri Mar 18 07:44:13 2011
@@ -206,6 +206,11 @@
private int pub_jitter = 0;
private int pub_Timeouts = 0;
private String pub_errmsg = "Test not run.";
+ private String pub_diagnosis = "Test not run.";
+ private String pub_statistics = "Test not run.";
+ private String pub_status = "notStarted";
+ private double pub_time = 0.0;
+ private int pub_bytes = 0;
private String isAutoRun;
@@ -416,6 +421,26 @@
//return result;
return pub_errmsg;
}
+
+ public String get_diagnosis()
+ {
+ return pub_diagnosis;
+ }
+
+ public String get_statistics()
+ {
+ return pub_statistics;
+ }
+
+ public String get_status()
+ {
+ return pub_status;
+ }
+
+ public String get_instSpeed()
+ {
+ return Double.toString((8.0 * pub_bytes) / (System.currentTimeMillis() - pub_time));
+ }
// "Remote Control" function - invoke NDT' runtest() method from the API
public void run_test()
@@ -766,6 +791,7 @@
}
synchronized public void runtest() {
+ pub_status = "notStarted";
new Thread(new TestWorker()).start();
}
@@ -855,6 +881,7 @@
results.append(messages.getString("checkingMiddleboxes") + " ");
statistics.append(messages.getString("checkingMiddleboxes") + " ");
emailText = messages.getString("checkingMiddleboxes") + " ";
+ pub_status = "checkingMiddleboxes";
if (ctl.recv_msg(msg) != 0) {
errmsg = messages.getString("protocolError") + Integer.parseInt(new String(msg.body), 16) + " instead\n";
@@ -896,6 +923,7 @@
try {
while ((inlth=srvin2.read(buff,0,buff.length)) > 0) {
bytes += inlth;
+ pub_bytes = bytes;
if ((System.currentTimeMillis() - t) > 5500)
break;
}
@@ -971,6 +999,7 @@
results.append(messages.getString("checkingFirewalls") + " ");
statistics.append(messages.getString("checkingFirewalls") + " ");
emailText = messages.getString("checkingFirewalls") + " ";
+ pub_status = "checkingFirewalls";
if (ctl.recv_msg(msg) != 0) {
errmsg = messages.getString("protocolError") + Integer.parseInt(new String(msg.body), 16) + " instead\n";
@@ -1087,6 +1116,7 @@
results.append(messages.getString("runningOutboundTest") + " ");
statistics.append(messages.getString("runningOutboundTest") + " ");
emailText += messages.getString("runningOutboundTest") + " ";
+ pub_status = "runningOutboundTest";
if (ctl.recv_msg(msg) != 0) {
errmsg = messages.getString("protocolError") + Integer.parseInt(new String(msg.body), 16) + " instead\n";
@@ -1144,6 +1174,7 @@
System.err.println("Send buffer size =" + i);
pkts = 0;
t = System.currentTimeMillis();
+ pub_time = t;
new Thread() {
public void run() {
@@ -1175,6 +1206,7 @@
break;
}
pkts++;
+ pub_bytes = (pkts * lth);
}
t = System.currentTimeMillis() - t;
@@ -1237,6 +1269,7 @@
results.append(messages.getString("runningInboundTest") + " ");
statistics.append(messages.getString("runningInboundTest") + " ");
emailText += messages.getString("runningInboundTest") + " ";
+ pub_status = "runningInboundTest";
if (ctl.recv_msg(msg) != 0) {
errmsg = messages.getString("protocolError") + Integer.parseInt(new String(msg.body), 16) + " instead\n";
@@ -1285,10 +1318,12 @@
inSocket.setSoTimeout(15000);
t = System.currentTimeMillis();
+ pub_time = t;
try {
while ((inlth=srvin.read(buff,0,buff.length)) > 0) {
bytes += inlth;
+ pub_bytes = bytes;
if ((System.currentTimeMillis() - t) > 14500)
break;
}
@@ -1338,6 +1373,7 @@
// Expose download speed to JavaScript clients
pub_s2cspd = s2cspd;
+ pub_status = "done";
srvin.close();
inSocket.close();
@@ -1375,6 +1411,7 @@
} catch (IOException e) {}
ctlSocket.setSoTimeout(0);
}
+ pub_status = "done";
return false;
}
@@ -1655,6 +1692,7 @@
pub_isReady="yes";
pub_errmsg ="All tests completed OK.";
+ pub_status = "done";
}
@@ -2196,6 +2234,7 @@
emailText += messages.getString("flowControlLimits") + " " + prtdbl(cwin/rttsec) + " Mbps\n%0A";
diagnosis.append("\n" + messages.getString("clientDataReports") + " '" + prttxt(c2sData) + "', " + messages.getString("clientAcksReport") + " '" + prttxt(c2sAck) + "'\n" + messages.getString("serverDataReports") + " '" + prttxt(s2cData) + "', " + messages.getString("serverAcksReport") + " '" + prttxt(s2cAck) + "'\n");
+ pub_diagnosis = diagnosis.getText();
}
@@ -2298,6 +2337,7 @@
statistics.append("\t" + messages.getString("serverSays") + " [" + scip + "], " + messages.getString("clientSays") +" [" + ccip + "]\n");
}
}
+ pub_statistics = statistics.getText();
} // middleboxResults()
- [ndt-dev] [ndt] r386 committed - Added API functions for new HTML5-based NDT client functionality., ndt, 03/18/2011
Archive powered by MHonArc 2.6.16.