Support Forums

Full Version: Division of large packets recieved into chunks of 4096 bytes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,
I am developing a web application that communicates with Web Service using SOAP.
I have got a web page that needs to display the log file which is around 2 mb in size, in a text area.
SOAP protocol carries the response with full log file information to the web client. But the firefox is displaying just 4096 bytes of the data received.. The reason for this is, Firefox or Mozilla divides the packets received with size greater thn 4096 bytes in to an array with each array element size being 4096 bytes.
This problem doesn't exist in IE. It displays the entire log page at one shot..
I tried to resolve this problem in javascript as follows :
i = 0;
var log_info = "";
try {
while(arrayElement[i] == 4096)
{
log_info = log_info + arrayElement[i++];
}
log_info = log_info + arrayElement[i];
} catch (exception e) {}
return log_info;

But this is creating delay in updating the log information in the browser text area.[Not in IE]
Is there any way to fix it, like , Is there any parameter which specifies the size of the chunks while dividing large data recieved, that can be dynamically set in javascript
This could indicate either:
  • A Bug in Firefox
  • Poor JavaScript Coding

I *think* it's likely to be b. Why? Because IE sucks, it accepts sucky JS. But Firefox's tastes are slightly better. Try Validating your page with that FF plugin I can't remember the name of that validates JS.
Hi Mike thanks for the reply...
The delay is not due to while loop in java script. As the SOAP response is received, in FF the xml nodes having data greater thn 4096 bytes was getting divided.
SOAP response :- <element>(data > 4096)</element>
FF alters it into :- <element>(data == first 4096 bytes of data)</element>
<element>(data == next 4096 bytes of data)</element>
.................. This continues till the data ends
I replaced the while loop in my earlier code with normalize function which combines all the adjacent child node values.
get_value() {
this.element.normalize;
return this.element.firstChild.nodeValue;
}
After a hard time, i found the root cause for the delay in FF which is not occurring in either Mozilla or IE.
I have got a text area in my web page, that holds the log information which can be very huge in size...
<textarea id="log"></textarea>
In java script after receiving the SOAP response i am updating the text area with the log info like this.
var loginformation = xmlDoc.get_value();
alert("Getting stuck here for few seconds");
document.getElementById("log").value = loginformation.

After displaying alert message, it is causing some delay depending upon the data size. Whereas in Mozilla or IE the problem doesn't persists...
Don't ask me! I don't know a thing about javascript..
No offense FW, but that was a rather unneeded post... Tongue

Just kidding.

Mike
Well, I suppose so, but I just had to say it. Tongue

Perhaps the users more advanced in JS than me can help this user! ;)

FW