I am using Socket connection to establish connections in my application. I have a problem when establishing the tunnel with the server: the connection is being closed 开发者_运维问答automatically after 3 minutes for example so when trying again to get data after 3 or 4 minutes, I will have an exception in the inputStream and outputStream. But the thread that opened the connection will not through any kind of exception since I included a try{ ... } catch (Exception ex) { }
.
Have you tried Socket.setKeepAlive(true)
?
This issue is disucsse over on BlackBerry support forums. It is important to remember that when using a portable connected wireless device there are many reasons the connection might go down, and having a short timeout may be beneficial in cases where the connection may not be reliable:
- Fringe areas
- inside buildings
- moving
精彩评论