On February 10, 2009 at 14:47, eht123 said...
As I mentioned above, I've tried a variety of methods
along those lines - periodically close and re-open the
connection, check and retry before each command, etc.
The problem is, they all work for a while, and then don't
work at all. So once the connection drops, no amount of
close/re-open attempts or anything will restart it. The
onClose and onError callbacks are sometimes triggered,
but sometimes not. Leaving the activity and coming back
to it is the only way to (usually) restart the connection.
You may be running out of sockets, if they don't close properly. Catch exceptions on all socket operations and print them all. I had similar and found that when connect fails it doesn't always close the socket (open but not connected, or some such), for instance.
Chris.