0
votes

I'm trying to send an image via a socket in as3 between two AIR applications that I made. It works fine with small images, but with the bigger ones, it gives me this error: "Error #2044: Unhandled IOErrorEvent:. text=Error #2124: Loaded file is an unknown type.". It repeats it several times, so I thought that the image might be cut to smaller ones, is that right? And if it is right, how to restore it??

1
Why not split image ByteArray for few messages ? Add some header to recoginze packages and than join and encode back to image . - turbosqel

1 Answers

0
votes

There is a limit on how much will be sent with each send operation (they should all be sent, just not in the same packet), meaning a single read-call won't get them all.

I would start by sending the total number of bytes that will be sent, followed by the actual data.

On the receiving end, just append the incoming data to a ByteArray until enough is read.