Reputation: 83
i have a problem with java, this problem is really strange..im write a client server application, this server suppor login function, after login i can use the application, the problem is that, if i not use the app for 10 minutes when i try to do somethings on the app , i see Connection Reset error on the stack log, the problem appear ONLY if i not use the app for 10 minutes, after 10 minutes for re use the app i must do again the login.. i cant post the code is over 5000 lines.. how i can solve that problem?
Upvotes: 2
Views: 2039
Reputation: 4042
Try using this: http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setKeepAlive(boolean).
public void setKeepAlive(boolean on)
throws SocketException
Enable/disable SO_KEEPALIVE.
Parameters:
on - whether or not to have socket keep alive turned on.
Upvotes: 1