login about faq

Hi guys, I am trying to local port forward in my iOS app. I am using cksshtunnel class for that. It returns true in the end but there is no log in my SSH server which shows that ssh tunnel has been established. I am using FreeSSHD for my ssh server on windows 7. Here I include a snippet of code from my app. I have seen the example given on chilkat site for port forwarding but that only returns a channel. I want my another application to listen to my local forwarded port (RDP in my case).

[tunnel setDestHostname: @""];  //pc i want to connect to
[tunnel setDestPort: [NSNumber numberWithInt:3389]];  //rdp port

/*my ssh server credentials*/
[tunnel setSshHostname:@""];
[tunnel setSshLogin:@"test"];
[tunnel setSshPassword:@"test"];
[tunnel setSshPort:[NSNumber numberWithInt:222]];
NSNumber * listenPort = [[NSNumber alloc]initWithInt:45678];

BOOL isTunnelmade = [tunnel BeginAccepting:listenPort];
NSLog(@"%d",isTunnelmade);  //prints YES
NSLog(@"%@", tunnel.TunnelErrors); //Nothing here
NSLog(@"%@", tunnel.TunnelThreadSessionLogPath); //Nothing here
NSLog(@"%d", tunnel.IsAccepting); // Prints YES
NSLog(@"%@", tunnel.GetTunnelsXml); 
NSLog(@"%@", tunnel.ConnectLog);
NSLog(@"%@", tunnel.ListenPort);   //45678

asked Dec 27 '12 at 07:29

PawanKumar's gravatar image


The call to BeginAccepting starts a background thread that will begin accepting incoming connections. No connection is made to the SSH server at that point. The background thread is simply waiting for incoming connections -- which may come from your foreground thread (such as a newly created TCP socket that makes a connection to localhost:listenPort, or some external program that connects to the listenPort.

When the background thread accepts a new connection on listenPort, it establishes a new connection to the SSH server. Incoming data is forwarded through the SSH server to the DestHostname:DestPort. Data arriving from the other direction (i.e. from DestHostname:DestPort, through the SSH server, and received in the background thread), is forwarded back to the connected socket.


answered Dec 27 '12 at 10:35

chilkat's gravatar image

chilkat ♦♦

Hey, Thanx for your reply. I called BeginAccepting (iOS simulator) and tried to connect to a remote machine through Microsoft RDP application installed on Mac(same machine as simulator) with localhost:listenport as IPAddress. But it is unable to make a connection. If I pass localhost:listenport to my rdp app(in which I am using your llibrary), it does not work either. Am I missing some other options of tunnel object that needed to be set?

I would really appreciate if you could provide a link or an example showing local port forwarding through chilkat, and using forwarded port in other app.

(Dec 28 '12 at 06:46) PawanKumar

For more information, see this: SSH Tunneling (Port Forwarding)


answered Dec 27 '12 at 10:36

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

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



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



Asked: Dec 27 '12 at 07:29

Seen: 1,714 times

Last updated: Dec 28 '12 at 06:46

powered by OSQA