Quantcast
Viewing all articles
Browse latest Browse all 1026

Created Issue: Reverse tunnel help [1538]

I think I am doing something wrong, I am trying to setup a remote tunnel. For testing purposes I have a local nodejs website listening on port 3000. I am doing an ssh connection to my amazon web instance and forwarding remote port 8501 down to port 3000 on my local machine.

I am getting the error the following error: "No connection could be made because the target machine actively refused it [fe80::b5c9:591a:c269:e092%11]:3000"

I thought this had something to do with my firewall, however I am able to get this to work if I set it up using Putty, so I am guessing that I am just missing some kind of setup thing.

Here is my code:

```
using (var client = new SshClient("ec2-blah.compute-1.amazonaws.com", "ec2-user", new PrivateKeyFile(@"c:\amazonkey\NewKey.pem")))
{
client.ErrorOccurred += (s, e) =>
{
//Just die for now
Console.WriteLine("ClientError: {0}", e.Exception.Message);
System.Environment.Exit(-1);
};

client.Connect();

//Make sure I am connected - see if this file exists on the server
client.RunCommand("touch WooHoo.txt");

var port1 = new ForwardedPortRemote("ec2-blah.compute-1.amazonaws.com", 8501, "localhost", 3000);

port1.Exception += (s, e) =>
{
//Just die for now
Console.WriteLine("Oops! Exception: " + e.Exception.Message);
if (port1.IsStarted) { port1.Stop(); System.Environment.Exit(-1); }

};

port1.RequestReceived += (s, e) =>
{
//Logging later
Console.WriteLine(string.Format("Recieved from: {0}:{1}", e.OriginatorHost, e.OriginatorPort));
};

client.AddForwardedPort(port1);
port1.Start();

//Just hang for now, until this is a service
System.Threading.Thread.Sleep(1000 * 60 * 10);
}
```

Viewing all articles
Browse latest Browse all 1026

Trending Articles