I have a program in c++ that sends a socket of 23723 bytes to a flash player in one "shot".
The flash player sometimes receives two packets of size 17520 and 6203, and other times it receives a single packet of 23723.
EDIT: There does not seem to be a way to obtain the total number of bytes associated with the send data from flash. This would make it very difficult to build a loop to reconstruct the "broken" packet.
I thought TCP was supposed to correctly recombine the packets and I am having difficulty recombining them myself.
This is my receiving handler in flash:
var socket:Socket = new Socket();
socket.addEventListener(Event.CONNECT, socketConnectHandler);
socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataReceivedHandler);
socket.connect("127.0.0.1", 7445);
socket.writeUTFBytes("hi");
private function socketDataReceivedHandler(event:ProgressEvent):void {
var socket:Socket = event.target as Socket;
trace(socket.bytesAvailable);
var data:ByteArray = new ByteArray();
socket.readBytes(data);
}
The command:
trace(socket.bytesAvailable);
will at times print 23723, and at other times, will print 17520 quickly followed by 6203. The total size are just examples and are subject to change for each send sockets. Also many sockets can be sent or received at the same time, so the split packets can be inter-mixed. In c++ I could determine what the total size of the sent data was, even if I did not receive the whole sent data yet.