By changing the ForwardedPortLocal parameters to:
var port = new ForwardedPortLocal("localhost", 3306, "localhost", 3306);
(to make it explicit what interface I was bound to) and adding the following code immediately before port.Start(); :
port.RequestReceived += delegate(object sender, PortForwardEventArgs e) { Console.WriteLine(e.OriginatorHost + ":" + e.OriginatorPort); };
I noticed that the following is output:
::1:60309
The e.OriginatorHost part was ::1 , which is equivalent to IPv6 localhost ; however, the destination server used IPv4. Change settings:
var port = new ForwardedPortLocal("127.0.0.1", 3306, "localhost", 3306);
made the tunnel work on top of IPv4, and my code worked exactly as I expected.
Adrian wragg
source share