Hi,
Am 03.08.2011 17:16, schrieb Oliver Stöneberg:
if I try to connect to a host via ssh_connect() and the host isn't
available the function blocks.
did you set a timeout?
No, thanks for the advice!
That actually didn't work until the 0.5.0 release :)
Are you sure? Timeout options works in my test program, but only with
the ssh_connect() function.
This could be the solution for my next problem. I want to detect if
someone for example unplugged the network cable while a ssh session is
running.
I have no idea how to do this, but if this happens libssh is/was
prone to hang since there are still polls without an timeout. That's
similar to the situation you had with ssh_connect().
I actually encountered a very serious ones, that was actually
happening with exec, but I haven't gotten access to a sample machine
yet, so I couldn't find out what was going on. It was limited to that
custom system though and is reproducible.
My idea was to use a QTcpSocket from the Qt lib. If the connection is
disconnected you can catch the "disconnected" signal of the socket and
then kill the ssh session thread. But till now, it's only a idea and not
practically tested ;)
Regards,
Thomas