On 2/16/12 4:20 PM, "Henrik Andersson" <[email protected]> wrote:
It is highly possible that multiple writes was stuffed into one read,
even if you don't flush between the writes.

The three "left over" bytes could be the first three bytes of the length
of the next object.

I left out some of the code in which I'm trying to account for receiving the 
object during separate ProgressEvents - my my ProgressEvent handler:

_socket.readBytes(_socketData);
if (_socketData.length < _messageLength) {
  // more data coming, exit the event handler and wait for the next 
ProgressEvent
  break;
}
trace('whole message assembled');
processData(_socketData); // function that expects the ByteArray
_socketData.clear();

Nonetheless, I'm testing the client and server on the same box and can tell the 
whole message is being received from traces.


On 2/16/12 4:20 PM, "Henrik Andersson" <[email protected]> wrote:

Mattheis, Erik (MIN-WSW) skriver:
> I'm not understanding something here - in the following excerpted and 
> simplified example, I'm trying to send a ByteArray of length 170 and there 
> seem to be 173 bytes received. Where are the "extra" bytes coming from and 
> and is that the reason readObject returns null? (tracing _socketData.toString 
> shows that the object properties I want to work with are in the ByteArray):
>

As I said before:

> This means that you MAY get more than one object in one go and that
you MAY get only a part of the object(s) at the ends of the buffer.

It is highly possible that multiple writes was stuffed into one read,
even if you don't flush between the writes.

The three "left over" bytes could be the first three bytes of the length
of the next object.

Your code must be able to deal with the crazy situation that it got a
full length int, the encoded object and only three quarters of the
length int for the next object in one go.
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



_ _ _
Erik Mattheis | Weber Shandwick
P: (952) 346.6610
M: (612) 377.2272
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to