Dear Ladies and Gentlemen,
having googled quite a bit, I am very sorry to bug you with the following
issue.
We use a TCP Socket to connect to our Pirna backend, which then performs an
operation for the Firefox OS client. Then, the results are transmitted back
to the device - the code looks as following:
window.onload = function() {
SOCKET = navigator.mozTCPSocket.open(HOST, PORT);
// ONOPEN:
SOCKET.onopen = function() {
output("SOCKET.onopen called...");
var str = ...; // This is our request string, content does not
matter here
output("Try to send this string: '"+str+"'");
var send = SOCKET.send(str+"\n");
if (send) {
output("The send process was successful");
} else {
output("The send process failed!");
}
};
// ONERROR:
SOCKET.onerror = function (e) {
output("Error:");
output(JSON.stringify(e));
};
// ONDATA:
SOCKET.ondata = function (event) {
output("SOCKET.ondata called...");
var str = event.data;
output("Received this string: ");
output(str);
fullString += str; // fullString is a global variable
};
// ONCLOSE:
SOCKET.onclose = function (event) {
output("SOCKET.onclose called...");
// test
if (fullString.indexOf('#') == -1) {
output("String does NOT contain the end-char '#'. The response
string should end with this character. Test failed! Program does not run
like expected!");
} else {
output("String contains the end-char '#', that's fine.");
}
};
};
When testing on a GeeksPhone Peek (running the latest released OSVER), some
queries don't get returned completely - instead, the device receives a
partial response missing the first ands/or the last part of the string,
which is transmitted in multiple steps.
Strangely, the program works flawlessly on a workstation running the
simulator in the same network.
With best regards from Slovakia, sweating under the heat
Tam Hanna
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g