swiftlighthe / kryonet

Automatically exported from code.google.com/p/kryonet
0 stars 0 forks source link

Server disconnecting when sending a lot of data in small chunks #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I am experiencing problems sending a lot of chunks of small amounts of data 
from my android phone to my computer.

What I am trying to achieve is sending the preview images from the camera to my 
computer, of which the smallest setting is an image of 176*144, which gives 
38016 bytes of data, stored in an array. First I had buffer overflows, so I 
split it up into parts of 512, 1024 or2048 bytes (I tried different settings), 
after also increasing the buffers up to 65536 bytes, for both the server and 
client (my computer is the server, my phone is the client).

The errors I am achieving are broken either SocketExceptions: Broken pipe or 
Connection is closed error. If I am correct, this indicates that my computer 
closes the connection while my phone still tries to send data. I have 
absolutely no clue why this happens, since I am not getting any errors on my 
computer (or any other messages for that matter, which is strange, considering 
I set the log level on LEVEL_TRACE, which did work on my phone). 
It might send the first chunk successfully and fail at the second. Or it might 
get to the 4th chunk. I never seem to receive anything on my computer though 
(according to my own output there). 
However, when I spam String-messages instead of chunks, that does work just 
fine and those get received.

I also tried sending only every 100th image (unacceptable, but it was just to 
try and test the concept of breaking up the images in smaller parts would 
work), but that didn't work either.

In short: 
- Sending images from my phone (client) to my computer (server), of about 38kb 
in size per image, or in smaller chunks per image of 512, 1024 or 2048 bytes, 
seems to make my computer break the connection.
- The computer never seems to receive any chunk at all.
- Sending strings instead of my own chunks does work.

I attached error reports from my phone (none from my computer since there 
aren't any messages coming out there).

Any suggestions would be appreciated. (I thought of making my phone the server, 
but didn't think it would matter much. Also, I might want to connect multiple 
phones to my computer, meaning I would have to initialise multiple clients. If 
it would solve my problems, I would though)

Original issue reported on code.google.com by rj.dre...@gmail.com on 20 Jul 2013 at 1:43

Attachments:

GoogleCodeExporter commented 9 years ago
P.S. error.txt shows the Broken pipe error, error2.txt the closed connection 
error, which actually seems to get caused by Kryonet being unable to update the 
connection (of which I have no clue what that means, other than something to 
keep it alive perhaps?).

Thanks in advance for any insights.

Original comment by rj.dre...@gmail.com on 20 Jul 2013 at 1:45