Hi,
Is it possible to do opening of several direct_tcpip channels in one SSH
session simultaneously (in async mode)?
I.e. to call libssh2_channel_direct_tcpip_ex(...) several times for one
session without waiting while previous calls to it are completed.
For example, is it possible to write something like the next (it is just
an example, not a compilable code):
list<channel_param> params; // List of parameters for creating channels
while (!params.empty()) {
for(list<channel_param>::iterator i = params.begin(); i !=
params.end(); ) {
LIBSSH2_CHANNEL * channel =
libssh2_channel_direct_tcpip_ex(session, i->host, i->port, ...);
if (!channel) {
if (last_error() != LIBSSH2_ERROR_EAGAIN) {
// Error, respond to the caller, remove channel from the
creation list.
NotifyError(*i);
i = params.erase(i);
} else {
++i;
}
} else {
// Channel created, respond to the caller, remove channel
from the creation list.
NotifyCreated(channel, *i);
i = params.erase(i);
}
}
}
As I saw in the source code, channel_direct_tcpip(...) uses some
variables in the 'session' structure (like session->direct_state,
session->direct_message and so on). So it seems that only one channel
creation call can be execute for a session at the moment. And the next
channel can be created only then a creation of the previous one is
finished (successfully or with error). Is it correct?
Thanks.
-- Best regards, Denis Malyshkin, Senior C++ Developer of ISS Art, Ltd., Omsk, Russia. Mobile Phone: +7 913 669 2896 Office tel/fax +7 3812 396959 Yahoo Messenger: dmalyshkin Web: http://www.issart.com E-mail: dmalyshkin_at_issart.com _______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-develReceived on 2012-02-01