Archived Forum Post

Index of archived forum posts

Question:

Socket over SOCKS5 issue with non responders

Apr 21 '16 at 14:56

I'm trying to use a socket over a SOCKS5 proxy setup using SSHTunnel. The socket connects to the Proxy without issue; ChilkatLog: Connect_Socket(1ms): DllDate: Dec 30 2015 ChilkatVersion: 9.5.0.55 UnlockPrefix: CISCOC Architecture: Little Endian; 64-bit Language: MAC OS X Python 2.* VerboseLogging: 1 objectId: 1 Component successfully unlocked using purchased unlock code. connectInner(1ms): hostname: 1.1.1.1 port: 22 tls: 0 maxWaitMs: 3000 socket2Connect(1ms): socks5Connect(1ms): SOCKS5: socksHostname: 127.0.0.1 socksPort: 1080 socksUsername: vuUoTU5nW9T>s. --SOCKS5 connectSocket: domainOrIpAddress: 127.0.0.1 port: 1080 connectTimeoutMs: 3000 connect_ipv6_or_ipv4: This is an IPV4 numeric address. Domain to IP address resolution not needed. connecting to IPV4 address... ipAddress: 127.0.0.1 createSocket: Setting SO_SNDBUF size sendBufSize: 262144 Setting SO_RCVBUF size recvBufSize: 4194304 --createSocket connect: Waiting for the connect to complete... myIP: 127.0.0.1 myPort: 62142 socket connect successful. --connect --connect_ipv6_or_ipv4 --connectSocket SOCKS5 server selected username/password authentication. --socks5Connect --socket2Connect socketOptions: SO_SNDBUF: 277644 SO_RCVBUF: 4197310 TCP_NODELAY: 0 SO_KEEPALIVE: 8 --socketOptions Success. --connectInner Success. --Connect_Socket --ChilkatLog

The connection to the host @1.1.1.1 failed but there is no indication in the error text or statuses until I shutdown the Proxy and view the accept log; ChilkatLog: sshOpenChannel: sshOpenChannel: Opening new SSH channel within SSH tunnel. sshTransportOpenChannel: channelType: direct-tcpip clientChannel: 100 clientInitialWindowSize: 327680 clientMaxPacketSize: 4096 directTcpHost: 1.1.1.1 directTcpPort: 22 originatorIP: 64.100.92.239 originatorPort: 62141 Sent open channel request Error reading channel response. --sshTransportOpenChannel Failed to open direct-tcpip channel failCode: 0 failReason: --sshOpenChannel --sshOpenChannel --ChilkatLog

In addition, closing the SSHTunnel proxy is taking the default 30 seconds to close which I assume might be the Socket Channel waiting to open on the non-responding device.

Any way to determine the status of the Socket's underlying channel after attempting to Connect?


Answer

There were some fixes relating to SSH tunnels in v9.5.0.56. I would recommend first testing that version to see where things stand..


Answer

Tried with the 9.5.0.56 version and still having issues.

ChilkatLog:
  Connect_Socket(1ms):
    ChilkatVersion: 9.5.0.56
    Component successfully unlocked using purchased unlock code.
    connectInner(1ms):
      hostname: 1.1.1.1
      port: 22
      tls: 0
      maxWaitMs: 3000
      socket2Connect(1ms):
        socks5Connect(1ms):
          SOCKS5:
            socksHostname: 127.0.0.1
            socksPort: 1080
            socksUsername: q{}P(v`T/TK6-S
          --SOCKS5
          connectSocket:
            domainOrIpAddress: 127.0.0.1
            port: 1080
            connectTimeoutMs: 3000
            connect_ipv6_or_ipv4:
              This is an IPV4 numeric address.
              Domain to IP address resolution not needed.
              connecting to IPV4 address...
              ipAddress: 127.0.0.1
              createSocket:
                Setting SO_SNDBUF size
                sendBufSize: 262144
                Setting SO_RCVBUF size
                recvBufSize: 4194304
              --createSocket
              connect:
                Waiting for the connect to complete...
                myIP: 127.0.0.1
                myPort: 50231
                socket connect successful.
              --connect
            --connect_ipv6_or_ipv4
          --connectSocket
          SOCKS5 server selected username/password authentication.
        --socks5Connect
      --socket2Connect
      socketOptions:
        SO_SNDBUF: 277644
        SO_RCVBUF: 4197310
        TCP_NODELAY: 0
        SO_KEEPALIVE: 8
      --socketOptions
      Success.
    --connectInner
    Success.
  --Connect_Socket
--ChilkatLog

The primary problem is the socket.Connect is succeeding in connecting to the proxy server but this is the only status available until the proxy is closed and the accept log is reviewed. The accept log then shows the SSHOpenChannel errors. There does not appear to be way to verify the success/failure of the SSHOpenChannel to the remote host in real-time. The process I'm working on is opening several socket connections to different remote hosts concurrently. The state of each socket to its remote host is needed.