login about faq

i'm already able to use the class CkSshTunnel and create a local socks server that download data using the ssh server as proxy. I'm using the DynamicPortForwarding idea. My code looks more or less like this:

    CkSshTunnel tunnel = new CkSshTunnel();

    String sshHostname = "SSH_HOST";
    int sshPort = SSH_PORT;

    //  Connect to an SSH server and establish the SSH tunnel:
    success = tunnel.Connect(sshHostname, sshPort);
    if (success != true) {
        System.out.println(tunnel.lastErrorText());
        return;
    }

    //  Authenticate with the SSH server via a login/password
    //  or with a public key.
    //  This example demonstrates SSH password authentication.
    success = tunnel.AuthenticatePw("SSH_USER","SSH_PASS");
    if (success != true) {
        System.out.println(tunnel.lastErrorText());
        return;
    }

    tunnel.put_SocksVersion(5);
    tunnel.put_InboundSocksUsername(null);
    tunnel.put_InboundSocksPassword(null);
    tunnel.put_DynamicPortForwarding(true);

    //  Start the listen/accept thread to begin accepting SOCKS proxy client connections.

    Boolean success = tunnel.BeginAccepting(10001);
    Thread.sleep(100000);
    ...

Well, the conection is created sucessfuly and the socks server start to accept conections BUG, once the first conections are made, seems that the server close it and dont let the backgound thread do more downloads :/

My idea is let it runing so multiple and simultaneus requests can be made.

Anyone have an ideia why the tunnel closes?

ON the accept log, i see this:

2015-11-22T00:35:58-0300 Listen thread started

2015-11-22T00:35:58-0300 listenPort: 10001

2015-11-22T00:36:12-0300 Listen thread started

2015-11-22T00:36:12-0300 listenPort: 10001

2015-11-22T00:36:17-0300 Accepted new client connection.

2015-11-22T00:36:17-0300 socksVersion: 5

2015-11-22T00:36:17-0300 socksDestIP: www.globo.com

2015-11-22T00:36:17-0300 socksDestPort: 80

2015-11-22T00:36:17-0300 Opened dynamic port-forwarded SSH channel.

2015-11-22T00:36:17-0300 Starting client manager thread...

2015-11-22T00:36:17-0300 Client manager thread started.

2015-11-22T00:36:17-0300 Starting tunnel manager thread...

2015-11-22T00:36:17-0300 Tunnel manager thread started.

2015-11-22T00:36:17-0300 Accepted new client connection.

2015-11-22T00:36:17-0300 socksVersion: 5

2015-11-22T00:36:17-0300 socksDestIP: s.glbimg.com

2015-11-22T00:36:17-0300 socksDestPort: 80

2015-11-22T00:36:18-0300 Opened dynamic port-forwarded SSH channel.

2015-11-22T00:36:18-0300 Starting client manager thread...

2015-11-22T00:36:18-0300 Client manager thread started.

2015-11-22T00:36:18-0300 Accepted new client connection.

2015-11-22T00:36:18-0300 socksVersion: 5

2015-11-22T00:36:18-0300 socksDestIP: s.glbimg.com

2015-11-22T00:36:18-0300 socksDestPort: 80

2015-11-22T00:36:56-0300 ChilkatLog:

sshOpenChannel(37312ms):

sshOpenChannel(37312ms):

  Opening new SSH channel within SSH tunnel.

  channelType: direct-tcpip

  clientChannel: 102

  clientInitialWindowSize: 327680

  clientMaxPacketSize: 4096

  directTcpHost: s.glbimg.com

  directTcpPort: 80

  originatorIP: 192.168.1.10

  originatorPort: 61112

  Sent open channel request

  sshReadMessage(37312ms):

    readSshPacket: Socket operation timeout.

    terminateConnection(265ms):

      TCP connection cleanly closed by peer.

      Cleanly terminated TCP connection.

    --terminateConnection

    nRemaining: -1016811137

    Failed to read more data on SSH connection.

    sshReadMessage: Socket operation timeout.

    sshReadMessage: Socket connection closed.

  --sshReadMessage

  Error reading channel response.

  Failed to open direct-tcpip channel

  failCode: 0

  failReason:

--sshOpenChannel

--sshOpenChannel

--ChilkatLog

2015-11-22T00:36:56-0300 failed to open SSH channel

2015-11-22T00:36:56-0300 Accepted new client connection.

2015-11-22T00:36:56-0300 Not yet connected to the SSH tunnel.

2015-11-22T00:36:56-0300 Accepted new client connection.

2015-11-22T00:36:56-0300 Not yet connected to the SSH tunnel.

2015-11-22T00:36:56-0300 Accepted new client connection.

2015-11-22T00:36:56-0300 Not yet connected to the SSH tunnel.

2015-11-22T00:36:56-0300 Accepted new client connection.

2015-11-22T00:36:56-0300 Not yet connected to the SSH tunnel.

2015-11-22T00:36:56-0300 Accepted new client connection.

Thanks!

asked Nov 21 '15 at 23:41

RenanGomes's gravatar image

RenanGomes
1


Many FTP clients will limit downloads to two at a time, each on a different connection. This is to reduce the possibility the bandwidth of the client and host will get saturated.

If you are attempting to start another transfer on a connection that is already handling a transfer, I believe that is always going to cause problems.

link

answered Nov 23 '15 at 09:53

TracyP's gravatar image

TracyP
1062

Me too, how to fix ?

link

answered Jan 07 at 04:01

neverbestboy's gravatar image

neverbestboy
1

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×89
×13

Asked: Nov 21 '15 at 23:41

Seen: 825 times

Last updated: Jan 07 at 04:01

powered by OSQA