I've a symbian app which acts as a server for a J2ME app and both communicate via a socket. The problem is, that the J2ME one might close the connection every now and then so I always check for "KErrEof" between the send operations on the server side (the client doesn't transmit anything).

But it seems, that the server sometimes misses the "EndofFile" error as the J2ME app sometimes hangs when trying to reconnect. I wrote a little piece of code in j2me which opens the connection, waits 5 seconds, then closes it and reopens it again immediately.
The best result I got was 3 reconnections and it got stuck at the 4th try. Sometimes I don't even get one single reconnection.

Does anybody have a clue, how to fix this problem? I've really run out of ideas what I could do...