ndt-dev - [ndt-dev] [ndt] r1058 committed - Added JSON support to flash client
Subject: NDT-DEV email list created
List archive
- From:
- To:
- Subject: [ndt-dev] [ndt] r1058 committed - Added JSON support to flash client
- Date: Fri, 23 May 2014 06:59:27 +0000
Revision: 1058
Author:
Date: Fri May 23 06:59:11 2014 UTC
Log: Added JSON support to flash client
http://code.google.com/p/ndt/source/detail?r=1058
Modified:
/branches/Issue147/flash-client/src/Handshake.as
/branches/Issue147/flash-client/src/Main.as
/branches/Issue147/flash-client/src/Message.as
/branches/Issue147/flash-client/src/NDTPController.as
/branches/Issue147/flash-client/src/NDTUtils.as
/branches/Issue147/flash-client/src/TestC2S.as
/branches/Issue147/flash-client/src/TestMETA.as
/branches/Issue147/flash-client/src/TestS2C.as
/branches/Issue147/flash-client/src/locale/en_US/DisplayMessages.properties
=======================================
--- /branches/Issue147/flash-client/src/Handshake.as Tue Apr 15 22:51:33 2014 UTC
+++ /branches/Issue147/flash-client/src/Handshake.as Fri May 23 06:59:11 2014 UTC
@@ -40,6 +40,7 @@
private var _testsRequestByClient:int;
// Has the client already received a wait message?
private var _isNotFirstWaitFlag:Boolean;
+ private static var _loginRetried:Boolean = false;
public function Handshake(ctlSocket:Socket, testsRequestByClient:int,
callerObject:NDTPController) {
@@ -55,9 +56,14 @@
var clientVersion:String = NDTConstants.CLIENT_VERSION;
msgBody.writeByte(_testsRequestByClient);
- msgBody.writeMultiByte(clientVersion, "us-ascii");
+ if (_loginRetried) {
+ _msg = new Message(MessageType.MSG_LOGIN, msgBody, false);
+ } else {
+ msgBody.writeMultiByte(clientVersion, "us-ascii");
+ _msg = new Message(MessageType.MSG_EXTENDED_LOGIN, msgBody,
+ Main.jsonSupport);
+ }
- _msg = new Message(MessageType.MSG_EXTENDED_LOGIN, msgBody);
if (!_msg.sendMessage(_ctlSocket)) {
failHandshake();
}
@@ -101,7 +107,7 @@
private function kickOldClients():void {
_msg = new Message();
if (!_msg.readBody(_ctlSocket, NDTConstants.KICK_OLD_CLIENTS_MSG_LENGTH))
- return;
+ return;
_msg = new Message();
_testStage = SRV_QUEUE1;
@@ -133,13 +139,30 @@
return;
if (_msg.type != MessageType.SRV_QUEUE) {
- TestResults.appendErrMsg(ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "loggingWrongMessage", null,
- Main.locale));
- failHandshake();
+ if (!_loginRetried) {
+ removeOnReceivedDataListener();
+ TestResults.appendDebugMsg(ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME,
+ "loggingUsingExtendedMsgFailed", null,
+ Main.locale));
+ // try to login using old MSG_LOGIN message
+ _testStage = KICK_CLIENTS;
+ _loginRetried = true;
+ Main.jsonSupport = false;
+ _callerObj.startNDTTest();
+ } else {
+ TestResults.appendErrMsg(ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "loggingWrongMessage", null,
+ Main.locale));
+ failHandshake();
+ }
}
- var waitFlagString:String = new String(_msg.body);
+ var waitFlagString:String = Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body);
TestResults.appendDebugMsg("Received wait flag = " + waitFlagString);
var waitFlag:int = parseInt(waitFlagString);
@@ -202,7 +225,8 @@
// Client should respond with a MSG_WAITING message.
var _msgBody:ByteArray = new ByteArray();
_msgBody.writeByte(_testsRequestByClient);
- _msg = new Message(MessageType.MSG_WAITING, _msgBody);
+ _msg = new Message(MessageType.MSG_WAITING, _msgBody,
+ Main.jsonSupport);
if (!_msg.sendMessage(_ctlSocket)) {
failHandshake();
}
@@ -246,7 +270,11 @@
return;
}
- var receivedServerVersion:String = new String(_msg.body);
+ var receivedServerVersion:String = Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body);
TestResults.appendDebugMsg("Server version: " + receivedServerVersion);
// See https://code.google.com/p/ndt/issues/detail?id=104.
if (receivedServerVersion != NDTConstants.EXPECTED_SERVER_VERSION)
@@ -301,7 +329,11 @@
return;
}
- var confirmedTests:String = new String(_msg.body);
+ var confirmedTests:String = Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body);
TestResults.ndt_test_results::testsConfirmedByServer =
TestType.listToBitwiseOR(confirmedTests);
=======================================
--- /branches/Issue147/flash-client/src/Main.as Fri Mar 21 10:33:50 2014 UTC
+++ /branches/Issue147/flash-client/src/Main.as Fri May 23 06:59:11 2014 UTC
@@ -28,6 +28,7 @@
public static var server_hostname:String = NDTConstants.SERVER_HOSTNAME;
public static var client_application:String = NDTConstants.CLIENT_ID;
public static var ndt_description:String = NDTConstants.NDT_DESCRIPTION;
+ public static var jsonSupport:Boolean = true;
public function Main():void {
if (stage)
=======================================
--- /branches/Issue147/flash-client/src/Message.as Sun Feb 2 19:14:17 2014 UTC
+++ /branches/Issue147/flash-client/src/Message.as Fri May 23 06:59:11 2014 UTC
@@ -31,11 +31,20 @@
private var _length:int;
public function Message(
- type:int=MessageType.UNDEF_TYPE, body:ByteArray=null):void {
+ type:int=MessageType.UNDEF_TYPE, body:ByteArray=null,
+ jsonFormat:Boolean = false):void {
_type = type;
_body = new ByteArray();
- if (body != null)
- _body.writeBytes(body);
+ if (body != null) {
+ if (jsonFormat) {
+ _body.writeUTFBytes(NDTUtils.createJsonFromSingleValue(
+ String(body)));
+ } else {
+ _body.writeBytes(body);
+ }
+ } else if(Main.jsonSupport) {
+ _body.writeUTFBytes(NDTUtils.createJsonFromSingleValue(""));
+ }
_length = _body.length;
}
@@ -90,6 +99,7 @@
header[0] = _type;
header[1] = (_length >> 8);
header[2] = _length;
+
try {
socket.writeBytes(header);
} catch(e:IOError) {
=======================================
--- /branches/Issue147/flash-client/src/NDTPController.as Fri Mar 21 10:33:50 2014 UTC
+++ /branches/Issue147/flash-client/src/NDTPController.as Fri May 23 06:59:11 2014 UTC
@@ -63,7 +63,13 @@
public function startNDTTest():void {
_currentTest = 0;
- TestResults.clearResults();
+ // socket was once opened so do not clear previous debug messages
+ // and just try to connect again to server using old MSG_LOGIN message
+ if (_ctlSocket) {
+ removeSocketEventListeners();
+ } else {
+ TestResults.clearResults();
+ }
TestResults.recordStartTime();
TestResults.ndt_test_results::ndtTestFailed = false;
TestResults.ndt_test_results::ndtErrStatus = "Test in progress.";
@@ -96,6 +102,14 @@
_ctlSocket.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
onSecurityError);
}
+
+ private function removeSocketEventListeners():void {
+ _ctlSocket.removeEventListener(Event.CONNECT, onConnect);
+ _ctlSocket.removeEventListener(Event.CLOSE, onClose);
+ _ctlSocket.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
+ _ctlSocket.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
+ onSecurityError);
+ }
private function onConnect(e:Event):void {
TestResults.appendDebugMsg("Control socket connected.");
@@ -197,6 +211,8 @@
private function getRemoteResults1():void {
if (!_msg.readHeader(_ctlSocket))
return;
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
if (_msg.type == MessageType.MSG_LOGOUT) {
// All results obtained.
@@ -216,9 +232,6 @@
}
private function getRemoteResults2():void {
- if (!_msg.readBody(_ctlSocket, _msg.length))
- return;
-
if (_msg.type != MessageType.MSG_RESULTS) {
TestResults.appendErrMsg(ResourceManager.getInstance().getString(
NDTConstants.BUNDLE_NAME, "resultsWrongMessage", null,
@@ -229,7 +242,11 @@
return;
}
- _remoteTestResults += new String(_msg.body);
+ _remoteTestResults += Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body);
_msg = new Message();
_testStage = REMOTE_RESULTS1;
if (_ctlSocket.bytesAvailable > 0)
=======================================
--- /branches/Issue147/flash-client/src/NDTUtils.as Thu Mar 27 20:00:04 2014 UTC
+++ /branches/Issue147/flash-client/src/NDTUtils.as Fri May 23 06:59:11 2014 UTC
@@ -24,6 +24,8 @@
import mx.resources.ResourceManager;
public class NDTUtils {
+ public static const JSON_DEFAULT_KEY:String = "msg";
+
/**
* Function that calls a JS function through the ExternalInterface class if
* it exists by the name specified in the parameter.
@@ -49,8 +51,8 @@
// in some cases and this exception is raised.
// TestResults.appendDebugMsg() calls callExternalFunction
- // to invoke JS callbacks. Without this check we can
- // recurse infinitely.
+ // to invoke JS callbacks. Without this check we can
+ // recurse infinitely.
if (functionName != "appendDebugOutput") {
TestResults.appendDebugMsg("Failed to call " + functionName + ": "
+ e.toString());
@@ -234,6 +236,36 @@
}
return bytesCount;
}
+
+ /**
+ * Creates string representing JSON object with single key:value pair
+ * where key is default and value is being taken from parameter.
+ *
+ * @param value null-terminated string containing value of map entry
+ * @return encoded JSON string
+ */
+ public static function createJsonFromSingleValue(value:String):String {
+ return "{\"" + JSON_DEFAULT_KEY + "\": \"" + value + "\"}";
+ }
+
+ /**
+ * Reads value from JSON object represented by jsonText using specific key
+ *
+ * @param jsonText string representing JSON object
+ * @param key by which value should be obtained from JSON map
+ */
+ public static function readJsonMapValue(jsonText:String,
+ key:String):String {
+ try {
+ var decodedObj:Object = JSON.parse(jsonText);
+ return decodedObj[key];
+ } catch(e:TypeError) {
+ TestResults.appendErrMsg("Error while trying to read value of " + key
+ + "from JSON: " + jsonText + "."
+ + " Original message: " + e);
+ }
+ return "";
+ }
}
}
=======================================
--- /branches/Issue147/flash-client/src/TestC2S.as Wed Apr 16 10:12:51 2014 UTC
+++ /branches/Issue147/flash-client/src/TestC2S.as Fri May 23 06:59:11 2014 UTC
@@ -147,7 +147,11 @@
Main.locale));
if (_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg(
- "ERROR MSG: " + parseInt(new String(_msg.body), 16));
+ "ERROR MSG: " + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_c2sTestSuccess = false;
endTest();
@@ -161,7 +165,11 @@
TestResults.appendDebugMsg(
"Each message of the C2S test has " + _dataToSend.length + " bytes.");
- var c2sPort:int = parseInt(new String(_msg.body));
+ var c2sPort:int = parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body));
_c2sSocket = new Socket();
addC2SSocketEventListeners();
try {
@@ -267,7 +275,8 @@
private function startTest():void {
if (!_msg.readHeader(_ctlSocket))
return;
- // TEST_START message has no body.
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
if (_msg.type != MessageType.TEST_START) {
TestResults.appendErrMsg(ResourceManager.getInstance().getString(
@@ -380,14 +389,22 @@
Main.locale));
if(_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg("ERROR MSG: "
- + parseInt(new String(_msg.body), 16));
+ + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_c2sTestSuccess = false;
endTest();
return;
}
- var sc2sSpeedStr:String = new String(_msg.body);
+ var sc2sSpeedStr:String = Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body);
var sc2sSpeed:Number = parseFloat(sc2sSpeedStr);
if (isNaN(sc2sSpeed)) {
TestResults.appendErrMsg(
@@ -418,7 +435,8 @@
private function finalizeTest():void {
if (!_msg.readHeader(_ctlSocket))
return;
- // TEST_FINALIZE message has no body.
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
if (_msg.type != MessageType.TEST_FINALIZE) {
TestResults.appendErrMsg(ResourceManager.getInstance().getString(
=======================================
--- /branches/Issue147/flash-client/src/TestMETA.as Fri Mar 21 10:33:50 2014 UTC
+++ /branches/Issue147/flash-client/src/TestMETA.as Fri May 23 06:59:11 2014 UTC
@@ -117,7 +117,11 @@
NDTConstants.BUNDLE_NAME, "metaWrongMessage", null, Main.locale));
if (_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg("ERROR MSG: "
- + parseInt(new String(_msg.body), 16));
+ + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_metaTestSuccess = false;
endTest();
@@ -139,7 +143,8 @@
private function startTest():void {
if (!_msg.readHeader(_ctlSocket))
return;
- // TEST_START message has no body.
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
if (_msg.type != MessageType.TEST_START) {
TestResults.appendErrMsg(
@@ -148,7 +153,11 @@
Main.locale));
if (_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg(
- "ERROR MSG: " + parseInt(new String(_msg.body), 16));
+ "ERROR MSG: " + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_metaTestSuccess = false;
endTest();
@@ -165,7 +174,8 @@
bodyToSend.writeUTFBytes(new String(
NDTConstants.META_CLIENT_OS + ":" + Capabilities.os));
- var _msg:Message = new Message(MessageType.TEST_MSG, bodyToSend);
+ var _msg:Message = new Message(MessageType.TEST_MSG, bodyToSend,
+ Main.jsonSupport);
if (!_msg.sendMessage(_ctlSocket)) {
_metaTestSuccess = false;
endTest();
@@ -176,7 +186,7 @@
bodyToSend.writeUTFBytes(new String(
NDTConstants.META_CLIENT_BROWSER + ":" + UserAgentTools.getBrowser(
TestResults.ndt_test_results::userAgent)[2]));
- _msg = new Message(MessageType.TEST_MSG, bodyToSend);
+ _msg = new Message(MessageType.TEST_MSG, bodyToSend, Main.jsonSupport);
if (!_msg.sendMessage(_ctlSocket)) {
_metaTestSuccess = false;
endTest();
@@ -187,7 +197,7 @@
bodyToSend.writeUTFBytes(new String(
NDTConstants.META_CLIENT_VERSION + ":"
+ NDTConstants.CLIENT_VERSION));
- _msg = new Message(MessageType.TEST_MSG, bodyToSend);
+ _msg = new Message(MessageType.TEST_MSG, bodyToSend, Main.jsonSupport);
if (!_msg.sendMessage(_ctlSocket)) {
_metaTestSuccess = false;
endTest();
@@ -197,7 +207,7 @@
bodyToSend.clear();
bodyToSend.writeUTFBytes(new String(
NDTConstants.META_CLIENT_APPLICATION + ":" + _clientApplication));
- _msg = new Message(MessageType.TEST_MSG, bodyToSend);
+ _msg = new Message(MessageType.TEST_MSG, bodyToSend, Main.jsonSupport);
if (!_msg.sendMessage(_ctlSocket)) {
_metaTestSuccess = false;
endTest();
@@ -206,7 +216,8 @@
// Client can send any number of such meta data in a TEST_MSG format and
// signal the send of the transmission using an empty TEST_MSG.
- _msg = new Message(MessageType.TEST_MSG, new ByteArray());
+ _msg = new Message(MessageType.TEST_MSG, new ByteArray(),
+ Main.jsonSupport);
if (!_msg.sendMessage(_ctlSocket)) {
_metaTestSuccess = false;
endTest();
@@ -224,7 +235,8 @@
private function finalizeTest():void {
if (!_msg.readHeader(_ctlSocket))
return;
- // TEST_FINALIZE message has no body.
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
if (_msg.type != MessageType.TEST_FINALIZE) {
TestResults.appendErrMsg(
=======================================
--- /branches/Issue147/flash-client/src/TestS2C.as Wed Apr 16 10:12:51 2014 UTC
+++ /branches/Issue147/flash-client/src/TestS2C.as Fri May 23 06:59:11 2014 UTC
@@ -44,6 +44,9 @@
private static const GET_WEB1001:int = 7;
private static const GET_WEB1002:int = 8;
private static const END_TEST:int = 9;
+ private static const THROUGHPUT_VALUE:String = "ThroughputValue";
+ private static const UNSENT_DATA_AMOUNT:String = "UnsentDataAmount";
+ private static const TOTAL_SENT_BYTE:String = "TotalSentByte";
private var _callerObj:NDTPController;
private var _ctlSocket:Socket;
@@ -150,14 +153,22 @@
Main.locale));
if (_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg(
- "ERROR MESSAGE : " + parseInt(new String(_msg.body), 16));
+ "ERROR MESSAGE : " + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_s2cTestSuccess = false;
endTest();
return;
}
- var s2cPort:int = parseInt(new String(_msg.body));
+ var s2cPort:int = parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body));
_s2cSocket = new Socket();
addS2CSocketEventListeners();
try {
@@ -250,7 +261,8 @@
private function startTest():void {
if (!_msg.readHeader(_ctlSocket))
return;
- // TEST_START message has no body.
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
if (_msg.type != MessageType.TEST_START) {
// See https://code.google.com/p/ndt/issues/detail?id=105
@@ -359,29 +371,44 @@
Main.locale));
if (_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg("ERROR MSG: "
- + parseInt(new String(_msg.body), 16));
+ + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_s2cTestSuccess = false;
endTest();
return;
}
- var _msgBody:String = new String(_msg.body);
- var _msgFields:Array = _msgBody.split(" ");
- if (_msgFields.length != 3) {
- TestResults.appendErrMsg(
- ResourceManager.getInstance().getString(
- NDTConstants.BUNDLE_NAME, "inboundWrongMessage", null,
- Main.locale)
- + "Message received: " + _msgBody);
- _s2cTestSuccess = false;
- endTest();
- return;
- }
+ var _msgBody:String, sc2sSpeed:Number, sSendQueue:int, sBytes:Number;
+ _msgBody = new String(_msg.body);
+ if (Main.jsonSupport) {
+ sc2sSpeed = parseFloat(NDTUtils.readJsonMapValue(_msgBody,
+ THROUGHPUT_VALUE));
+ sSendQueue = parseInt(NDTUtils.readJsonMapValue(_msgBody,
+ UNSENT_DATA_AMOUNT));
+ sBytes = parseFloat(NDTUtils.readJsonMapValue(_msgBody,
+ TOTAL_SENT_BYTE));
+ } else {
+ var _msgFields:Array = _msgBody.split(" ");
+ if (_msgFields.length != 3) {
+ TestResults.appendErrMsg(
+ ResourceManager.getInstance().getString(
+ NDTConstants.BUNDLE_NAME, "inboundWrongMessage", null,
+ Main.locale)
+ + "Message received: " + _msgBody);
+ _s2cTestSuccess = false;
+ endTest();
+ return;
+ }
+
+ sc2sSpeed = parseFloat(_msgFields[0]);
+ sSendQueue = parseInt(_msgFields[1]);
+ sBytes = parseFloat(_msgFields[2]);
+ }
- var sc2sSpeed:Number = parseFloat(_msgFields[0]);
- var sSendQueue:int = parseInt(_msgFields[1]);
- var sBytes:Number = parseFloat(_msgFields[2]);
if (isNaN(sc2sSpeed) || isNaN(sSendQueue) || isNaN(sBytes)) {
TestResults.appendErrMsg(
ResourceManager.getInstance().getString(
@@ -414,11 +441,12 @@
+ s2cSpeed.toFixed(2) + " kbps.");
var sendData:ByteArray = new ByteArray();
- sendData.writeFloat(s2cSpeed);
+ sendData.writeUTFBytes(String(s2cSpeed));
TestResults.appendDebugMsg(
- "Sending '" + s2cSpeed + "' back to the server.");
+ "Sending '" + String(s2cSpeed) + "' back to the server.");
- var _msgToSend:Message = new Message(MessageType.TEST_MSG, sendData);
+ var _msgToSend:Message = new Message(MessageType.TEST_MSG, sendData,
+ Main.jsonSupport);
if (!_msgToSend.sendMessage(_ctlSocket)) {
_s2cTestSuccess = false;
endTest();
@@ -454,7 +482,9 @@
if (!_msg.readHeader(_ctlSocket))
return;
+
if (_msg.type == MessageType.TEST_FINALIZE) {
+ TestResults.appendDebugMsg("!!" + _msg.type + " " + _msg.length +
"\n");
// All web100 variables have been sent by the server.
_readTimer.stop();
_readTimer.removeEventListener(TimerEvent.TIMER, onWeb100ReadTimeout);
@@ -473,14 +503,17 @@
private function getWeb100Vars2():void {
if (!_msg.readBody(_ctlSocket, _msg.length))
return;
-
if (_msg.type != MessageType.TEST_MSG) {
TestResults.appendErrMsg(ResourceManager.getInstance().getString(
NDTConstants.BUNDLE_NAME, "inboundWrongMessage", null,
Main.locale));
if (_msg.type == MessageType.MSG_ERROR) {
TestResults.appendErrMsg("ERROR MSG: "
- + parseInt(new String(_msg.body), 16));
+ + parseInt(Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body), 16));
}
_readTimer.stop();
_readTimer.removeEventListener(TimerEvent.TIMER, onWeb100ReadTimeout);
@@ -489,13 +522,19 @@
endTest();
return;
}
- _web100VarResult += new String(_msg.body);
+ _web100VarResult += Main.jsonSupport ?
+ new String(NDTUtils.readJsonMapValue(
+ String(_msg.body),
+ NDTUtils.JSON_DEFAULT_KEY))
+ : new String(_msg.body);
_testStage = GET_WEB1001;
if (_ctlSocket.bytesAvailable > 0)
getWeb100Vars1();
}
private function endTest():void {
+ if (!_msg.readBody(_ctlSocket, _msg.length))
+ return;
TestResults.ndt_test_results::s2cTestResults = _web100VarResult;
removeCtlSocketOnReceivedDataListener();
=======================================
--- /branches/Issue147/flash-client/src/locale/en_US/DisplayMessages.properties Sun Feb 2 19:14:17 2014 UTC
+++ /branches/Issue147/flash-client/src/locale/en_US/DisplayMessages.properties Fri May 23 06:59:11 2014 UTC
@@ -98,6 +98,7 @@
linkFullDpx = Link set to Full Duplex mode
linkHalfDpx = Link set to Half Duplex mode
loggingWrongMessage = Logging to server: Received wrong type of the message
+loggingUsingExtendedMsgFailed = Logging to server: Failed to login using MSG_LOGIN_EXTENDED message. Trying again with old MSG_LOGIN.
lookupError = Unable to obtain remote IP address
mboxWrongMessage = Middlebox test: Received wrong type of the message
meta = META
@@ -123,7 +124,7 @@
ooOrder = but packets arrived out-of-order
options = Options
osData = OS data:
-otherClient = Another client is currently being served, your test will begin within
+otherClient = Another client is currently being served, your test will begin within
otherTraffic = Information: Other network traffic is congesting the link
outboundTest = Tcpbw100 outbound test...
outboundWrongMessage = C2S throughput test: Received wrong type of the message
@@ -196,7 +197,7 @@
systemFault = System Fault
test = Test
testsuiteWrongMessage = Negotiating test suite: Received wrong type of the message
-theSlowestLink = The slowest link in the end-to-end path is a
+theSlowestLink = The slowest link in the end-to-end path is a
theoreticalLimit = The theoretical network limit is
thisConnIs = This connection is
timesPktLoss = times due to packet loss
@@ -231,5 +232,5 @@
oc48Str = OC-48
tengigabitEthernetStr = 10 Gig
systemFaultStr = systemFault
-dialupStr = dialup2
+dialupStr = dialup2
rttStr = rtt
- [ndt-dev] [ndt] r1058 committed - Added JSON support to flash client, ndt, 05/23/2014
Archive powered by MHonArc 2.6.16.