On Tue, Sep 4, 2012 at 11:05 AM, Alexander Lamaison <swish_at_lammy.co.uk> wrote:
> On 4 September 2012 07:44, anirudh nair <anirudh.anu01_at_gmail.com> wrote:
>
>> 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.
I've been running some tests (connecting to a Linux host running on a
VM), as I'm attempting to integrate libssh2 and boost::asio, and I'd
like to keep a pool of open sessions (thus, needing to keep idle
sessions/connections alive).
When using SSH's keepalive (defined by ClientAliveInterval and
ClientAliveCountMax in sshd_config), I've had coherent results - the
session was dropped when expected.
When using TCP keepalive's default values, results are also coherent -
if I don't enable asio tcp::socket' keepalive, the connection drops
after little more than 2 hours; if I enable asio tcp::socket's
keepalive, the connection goes on and on (I finally shut it down after
6 hours idle).
The last test I ran, however, was mystifying. I've set TCP's keepalive
to 3 mins, and its repeated probes to 3 every 30 secs. I didn't enable
the socket's keepalive. So, it should've died after +/- 4.5 mins. And
yet, the connection went on and on, hitting the same 6 hour mark,
until I shut it down. I'm still trying to figure out what happened
here.
Paulo Caetano
http://cidebycide.blogspot.pt/
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2012-09-13