-
July 21st, 2014, 11:50 AM
#1
does os close a tcp connection due to idleness?
we have implemented a remote control program.
we have noticed that if an user doesn't send any control command for a long time (for example about one to two hours), the socket gets closed for some reason.
I have googled about this problem, it seems that tcp protocol doesn't have this rule. is this something introduced by the os? is sending heartbeat packet the only solution? is there any tcp socket flag I can tweak to disable this disconnection behavior ?
-
July 21st, 2014, 06:12 PM
#2
Re: does os close a tcp connection due to idleness?
not if the machine goes into standby, or is shutdown. logmein rescue has the ability to log in to any saved machine
-
July 22nd, 2014, 05:10 AM
#3
Re: does os close a tcp connection due to idleness?
It's not part of TCP, but it is part of the OS to attempt to recover/recycle unused connections.
Without a feature like this, it would be very easy for a malicious program to starve the server of resources/sockets.
There's not typically anything you can do to prevent it. IIRC there are some registry settings on Windows that prevent this on the server side, but enabling them is likely to open your server for a lot of hurt.
So in short, your app (and server) needs to find a way to handle disconnects. Many TCP based programs have a 'reconnect' type option for this, this could be automatic or manual.
You can prevent the server side from closing the connection via a "keep alive" type heartbeat/pulse. Some apps need this explicitly, some apps send enough data on a regular basis to not need an explicit heartbeat.
But even with a regular data traffic, you can still get disconnects for various reasons. Networks are somewhat unreliable.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|