After some thought... the 2nd case (not enough data arrived)
is not a problem for your code, because the handleTcpData()
will get called again - once the rest of the data arrived.
But for the 1st case (several UTF strings arrived at once)...
Maybe I should try the following (and don't need a ByteArray):
private function handleTcpData(event:Event):void {
// KEEP EXTRACTING UTF-STRINGS
while(_socket.bytesAvailable) {
try{
var str:String = _socket.readUTF();
updateGUI(str);
}catch(e:Error){
// INCOMPLETE STRING, WILL BE READ LATER
return;
}
}
}
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders