writing to socket with setinterval not working in windows
Hello Everyone,
I'm trying to stream a big file to my server, and was using 'setInterval' just fine to slowly upload it from OS X, but when I moved my AIR application to a Windows Vista computer, it no longer worked. I started doing some investigation and found out that 'socket.writeBytes' function was not working inside of 'setInterval'. I then moved the code inside of 'setInterval' to outside of it and everythink worked, but obviously it was no longer streaming. Thinking there was something wrong with 'setInterval', I tried it without the 'socket.writeBytes' function in it, and it started working fine.
Not sure what is happening, but it seems like a bug in the air.Socket code.
Here is my code:
var socket = new air.Socket();
socket.addEventListener(air.Event.CONNECT, function(e) {
var stream = setInterval(function() {
socket.writeBytes(filePart, 0, filePart.length);
if (isDone) {
clearInterval(stream);
}
}, 1000);
});
socket.connect("myServer", 80);
P.S. I also tried using 'air.Timer' and it was the same behavior as 'setInterval'.
Thanks for any help.