I have some code that uses URLStream to make a connection to a server
and wait for data. I pass XML (with a command to connect) in the HTTP
POST.
Here is the weird part: If that request is longer than around 58
bytes, I do not get a progress event even though I see the data on the
client side with Ethereal. If it is 57 bytes or smaller I receive the
progress event. Has anybody come across this type of problem? Any
ideas on what may be causing it?
BTW, I did encounter the problem where IE would not receive the
progress event if there were less than 1024 or 2048 bytes but I took
care of that by adding some spaces at the end of the response. I have
also tested with two different servers, a tomcat servlet and an
internal HTTP server.
Thanks!
Here is some sample code, all I have to do to get it to not receive
the progressEvent is increase the number of bytes in the XML, for
example if I use id="123456789" or timeout="600000":
var requestXML:XML = new XML("<XMLRequest id="1234"
timeout="600"><Connect/></XMLRequest>");
var streamer:URLStream = new URLStream();
streamer.addEventListener(ProgressEvent.PROGRESS, handleProgress);
streamer.addEventListener(IOErrorEvent.IO_ERROR, handleError);
streamer.addEventListener(Event.COMPLETE, handleComplete);
streamer.addEventListener(Event.OPEN, handleOpen);
streamer.addEventListener(HTTPStatusEvent.HTTP_STATUS, handleStatus);
var request:URLRequest = new URLRequest("http:\\localhost:8084\test");
request.method = URLRequestMethod.POST;
request.contentType = "text/xml";
request.data = requestXML;
var rhArray:Array = new Array(new URLRequestHeader("Cache-Control",
"no-cache"));
request.requestHeaders = rhArray;
streamer.load(request);