On 14.04.2018 18:35, [email protected] wrote: > > On 14.04.2018 17:58, Andreas Schneider wrote: >> On Saturday, 14 April 2018 15:55:20 CEST [email protected] wrote: >>> On 11.04.2018 18:09, [email protected] wrote: >>>> On 11.04.2018 17:31, Andreas Schneider wrote: >>>>> ould appreciate a lot if someone could show me some sample code. >>>>> I think that ssh_event_dopoll() will handle it and call the appropriate >>>>> callback. Don't use ssh_select() >>>>> >>>>> In master we have the new connector API which is easier to use, see >>>>> https://git.libssh.org/projects/libssh.git/tree/examples/ssh_client.c >>>> Thanks, I think that's the issue: The main event polling is not called >>>> why my code waits for a connection. But how do I get the event to which >>>> are attached the default handlers of libssh? >>>> >>>> I also looked at the sample code which uses the event API for polling on >>>> the channel. But this would not solve my issue with global keep-alive >>>> requests. They are sent while no channel exists. IMHO it's an issue with >>>> handling messages in the main loop while no channels are open. >>> Well, maybe I should ask it this way: >>> >>> How can I keep the internal main loop running, i.e. the default >>> callbacks being triggered, when nothing else is going on? >> You need to call of of the ssh poll functions, e.g. ssh_channel_poll() or >> ssh_event_dopoll() this will also trigger the standard callbacks if >> something >> is in the queue. > This is what I tested before (ssh_event_dopoll)... But maybe it did not > work because I had a "blank" event without anything attached to it. I'll > try it again. > Thanks. Solved! Adding the session's poll handle to the event did do the trick: rc = ssh_event_add_session(event, session);
Thank you for the support. Till
