Archived Forum Post

Index of archived forum posts

Question:

SSH Server Disconnects Idle Connection?

Jul 11 '12 at 09:26

If I get a SSH connection, can I assume this one will be maintained even if there is no data being sent? Or should I expect that it will become disconnected?


Answer

It depends on the behavior of each particular server. Some may disconnect after a connection has been idle too long (just like any server might do, such as for FTP, HTTP, POP3, IMAP, etc.)

Most protocols have a "NOOP" ("no operation") message for the purpose of keeping the connection from being idle. With SSH, it's the "SendIgnore" method that can be called to send an "ignore" message, which is SSH's version of the NOOP. You could periodically call SendIgnore to try to prevent the server from closing an idle connection.