www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: SSH timeout

Re: SSH timeout

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Tue, 4 Sep 2012 11:05:43 +0100

On 4 September 2012 07:44, anirudh nair <anirudh.anu01_at_gmail.com> wrote:
> Is it advisable to persist the SSH session object(LIBSSH2_SESSION).

By 'persist' I assume you just mean keeping the session object around
to use later rather than the usual meaning of 'persist' which means
saving to disk?

> Are there chances for the session to timeout.

Absolutely, the server is free to terminate the connection after a
period idle. Some severs make this period quite large so timeouts
aren't such a problem. Others, particularly embedded servers set this
to a few seconds.

> Can I set the session not to timeout at all?

No. The server can do whatever it likes. But, you can encourage most
servers to hold the connection open by responding to its keepalive
requests during idle time. These get processed when you call a
libssh2 API function that reads from the channel but that's not much
use if you really intend to be idle. I plan to add an API function
that just processes the outstanding packets but I've not found the
time. In the mean time, calling the deprecated libssh2_poll might do
the trick.

Alex

-- 
Swish - Easy SFTP for Windows Explorer (http://www.swish-sftp.org)
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-09-04

the libssh2 team