Hi, I am working on a UI application where the user can click to either pass some preset remote commands or request data from a file on an openssh server.
I open a libssh session and connect to the server at the beginning of the program. If the user makes a request I open a channel (either a regular channel or an scp channel) to fulfill the request. I then close the channel again when it is done. My problem is that if I leave the session idle for too long without opening a channel I get a "Socket exception callback: 2 (10053)" when I try to open a channel again. (The user application is currently running on Windows, but I will target both Windows and Linux). I assume this is because the firewall has shut down the connection since it has been idle for too long. I have tried to set the ClientAliveInterval and ClientAliveCountMax settings in etc/ssh/sshd_config at the server. This does not in itself help. I assume this is because I would have to make my application receive and respond to that signal. How would I go about doing that? Alternatively, is there any other strategy in libssh to keep the session alive? I would prefer not to open a new session each time I need to communicate with the server since it adds noticeable lag. PS. I call ssh_is_connected to see if the session is still alive, but this returns 1, even right before I get the socket exception when I try to open the channel. Best Wishes, Magnus