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

Archive Index This month's Index

Subject: Re: How to get file descriptor of channel?

Re: How to get file descriptor of channel?

From: Henrik Nordström <henrik_at_henriknordstrom.net>
Date: Tue, 16 Aug 2011 07:36:08 +0200

It's the same filedescriptor you gave in libssh2_session_startup. SSH multiplexes all channels over the same encrypted connection.

See also libssh2_session_blocking_directions() and libssh2_session_set_blocking().

note: libssh2 prefers you use your preferred event loop (select, poll etc). There is a simple event handler provided in libssh2_poll, but it's deprecated and should preferably not be used.

 
----- Ursprungsmeddelande -----
> Hello folks,
>
> I've started using this very good library and first of i want to say
> thanks. The second is i want to know the file descriptor of channel
> (or whatever) which is used in select/poll so i could re-use it in my
> own polling mechanism (don't ask why, we live in a world of many
> libraries and many of them have own readable/writable watchers so i
> just want to use one at the time, not all). Is there any way how can i
> do it? I checked the public API and didn't find anything interesting.
> The original problem comes from using of libnet-ssh2-perl which uses
> 250ms timeout for polling. 250ms is too much for me, moreover, i don't
> want to wait for 250ms on every "read-call" just to check if there is
> a data or not. I want to attach a file descriptor to some abstract
> watcher, wait for "readable" event and read till the end or
> EAGAIN/EWOULDBLOCK (whatever will happen first, it's just an example).
>
> Thank you!
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-08-16

the libssh2 team