Subject: Multiple channels and blocking question

Multiple channels and blocking question

From: Dmitry Teslenko <>
Date: Tue, 21 Dec 2010 12:36:49 +0300

I want to establish and close multiple channels in one ssh session.
How to init and properly shutdown them? Because way it shown
in examles does not work.

direct_tcpip.c example do it this way:

1) creating new channel
        libssh2_session_set_blocking(session, 1);
        LIBSSH2_CHANNEL *channel = libssh2_channel_direct_tcpip_ex(

2) channel read-write
        libssh2_channel_set_blocking(channel, 0);
        //read-write here

3) shutting down channel

But this way I can't start channel on second connection. libssh2 says:
Could not open the direct-tcpip channel!
(Note that this can be a problem at the server! Please review the server logs.)

Also I get LIBSSH2_ERROR_EAGAIN error all the time in unblocking mode.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
Received on 2010-12-21