I'm using ActionScript3 in Flash 9 alpha... I've got a great Socket setup working, but when the network traffic gets high, TCP's nature is to combine and/or break up packets... The problem with this is that the incoming data event gets fired before a complete object has transmitted...
I see no way to "know" if the entire object has arrived yet; so to find out, I just try. If the object isn't all there yet, it throws an error and I bail until more data comes in. The problem is, even when readObject fails, it trashes the data. (evidenced by the trace). Any ideas on how to fix this? Here's the code: function newSocketData() { var result; while(1) { var bufsize:Number = sock.bytesAvailable; try { result = sock.readObject(); } catch (e:EOFError) { trace("Data before: " + bufsize + " -- Now: " + sock.bytesAvailable); return; } handleObject(result); } } - Kipp _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com