download from android through servlet causes "SocketException - Connection

Hi, I have investigated this for 2 days now and I am still not sure where the issue lies.

I am connecting through an android app to a servlet in my vaadin application to download a file.

The server side is done the “standard” way through streams and I am able to get the file through apps like curl, so I assume it works.

The android side is also done through streams and if I download any file from the internet it works.

But when I connect those two together, the download starts and around 80% it breaks causing a SocketException - Connection reset.

The serverside doesn’t even issue an exception, but on the clientside it simply seems to break.

At this point I am clueless and not so sure that the problem couldn’t be on my vaadin side.

Did anyone experience something similar? Does anyone have any kind of advice?

Thanks a ton,
Andrea

I found the problem to this. For some reason the android app was setting the header “Connection” to “close”. Once I have forced this to “keep-alive”, the problems stopped.

At this point the post is off-topic, but I found it right to at least add the solution, in case this happens to anyone else.

Cheers,
Andrea