Subject: Re: libssh2_channel_direct_tcpip_ex

Re: libssh2_channel_direct_tcpip_ex

From: Aristidis Zoutsos <azouts_at_gmail.com>
Date: Thu, 7 Feb 2013 18:03:36 +0200

*Here is a debug log:*

*2013-02-07 17:49:46.181 SSH-Proxied-WebView[25443:11303] thread support
enabled*

*2013-02-07 17:49:46.444 SSH-Proxied-WebView[25443:11303] SSH Forwarder
started on port: 8889 and host: 0.0.0.0*

*2013-02-07 17:49:50.420 SSH-Proxied-WebView[25443:11303] open ssh
connections 1*

*2013-02-07 17:49:50.421 SSH-Proxied-WebView[25443:11303] open http proxy
sockets 0*

*2013-02-07 17:49:50.656 SSH-Proxied-WebView[25443:15603] ssh trace:
[libssh2] 0.656385 Conn: Requesting direct-tcpip session to from
0.0.0.0:16807 to 127.0.0.1:14530*

*2013-02-07 17:49:50.657 SSH-Proxied-WebView[25443:15603] ssh trace:
[libssh2] 0.657024 Conn: Allocated new channel ID#0*

*2013-02-07 17:49:50.657 SSH-Proxied-WebView[25443:15603] ssh trace:
[libssh2] 0.657528 Conn: Opening Channel - win 262144 pack 32768*

*2013-02-07 17:49:50.658 SSH-Proxied-WebView[25443:15603] ssh trace:
[libssh2] 0.658102 Failure Event: -37 - Would block*

*2013-02-07 17:49:50.666 SSH-Proxied-WebView[25443:15603] ssh trace:
[libssh2] 0.666295 Conn: Connection Established - ID: 0/0 win:
262144/262144 pack: 32768/32768*

*2013-02-07 17:49:50.667 SSH-Proxied-WebView[25443:15603] ssh trace:
[libssh2] 0.667081 Conn: Setting blocking mode OFF*

*2013-02-07 17:49:50.675 SSH-Proxied-WebView[25443:17003] ssh trace:
[libssh2] 0.675713 Conn: Requesting direct-tcpip session to from
0.0.0.0:16807 to 127.0.0.1:14530*

*2013-02-07 17:49:50.675 SSH-Proxied-WebView[25443:17003] ssh trace:
[libssh2] 0.675934 Conn: Allocated new channel ID#1*

*2013-02-07 17:49:50.676 SSH-Proxied-WebView[25443:17003] ssh trace:
[libssh2] 0.676066 Conn: Opening Channel - win 262144 pack 32768*

*Could not open the direct-tcpip channel!*

*(Note that this can be a problem at the server! Please review the server
logs.)*

*2013-02-07 17:49:50.676 SSH-Proxied-WebView[25443:17003] Failed
establishing tunnel*

*2013-02-07 17:49:50.677 SSH-Proxied-WebView[25443:16a07]
[TunneledURLProtocol] Request: http://192.168.0.142/demo*

*2013-02-07 17:49:50.677 SSH-Proxied-WebView[25443:16a07]
[TunneledURLProtocol] Got response 502: content-type:
application/octet-stream*

*2013-02-07 17:49:50.677 SSH-Proxied-WebView[25443:16a07]
HTTPConnectionDidFinishLoading conn:<CKHTTPConnection: 0x934b4a0>*

*2013-02-07 17:49:50.728 SSH-Proxied-WebView[25443:11303]
[SecureWebViewController] Error: The operation couldn’t be completed. (HTTP
Status code: error 502.)*

The code that requests a new channel using a valid session:

- (LIBSSH2_CHANNEL *)establishCFTunnelWithMaxRetries:(int)maxRetries

{

    if(--maxRetries<=0) {

        return nil;

    }

    LIBSSH2_CHANNEL *channelg = libssh2_channel_direct_tcpip_ex(self.
sessiong,

                                                    [Z_SSH_REMOTE_FW_HOST
cStringUsingEncoding:NSUTF8StringEncoding],

                                                    Z_SSH_REMOTE_FW_PORT,

                                                    [self.host
cStringUsingEncoding:NSUTF8StringEncoding],

                                                    self.port);

    if (channelg==nil) {

        fprintf(stderr, "Could not open the direct-tcpip channel!\n"

                "(Note that this can be a problem at the server!"

                " Please review the server logs.)\n");

        return [self establishCFTunnelWithMaxRetries:maxRetries];

    }

    /* Must use non-blocking IO hereafter due to the current libssh2 API */

    libssh2_session_set_blocking(self.sessiong, 0);

    return channelg;

}

On Thu, Feb 7, 2013 at 9:56 AM, Peter Stuge <peter_at_stuge.se> wrote:

> Aristidis Zoutsos wrote:
> > it cannot reestablish a new channel
>
> You are providing no information whatsoever about what is happening,
> so it is impossible to help you. Send a debug log.
>
>
> //Peter
> _______________________________________________
> 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 2013-02-07