我使用SSH.NET编写GUI来创建与VPS的连接。我的目的是建立一个代理服务器来玩在线游戏。
我需要动态转发端口,创建SOCKS服务器然后,Proxifier(我的计算机上安装的另一个程序)可以连接到此服务器。
当我使用PuTTY时,Proxifier运行良好,但是当我使用我的软件时,它无效。
这是我的代码:
using (client = new SshClient("VPS_IP", "USER", "PASSWORD"))
{
client.KeepAliveInterval = new TimeSpan(0, 0, 60);
client.ConnectionInfo.Timeout = new TimeSpan(0, 0, 50);
port = new ForwardedPortDynamic("127.0.0.1", portNumber);
client.Connect();
client.AddForwardedPort(port);
port.Start();
if (client.IsConnected && port.IsStarted)
{
MessageBox.Show("Connected");
}
System.Threading.Thread.Sleep(20 * 1000);
}
现在,Proxifier的日志
[48:51] Testing Started.
Proxy Server
Address: 127.0.0.1:port
Protocol: SOCKS 5
Authentication: NO
[48:51] Starting: Test 1: Connection to the Proxy Server
[48:51] IP Address: 127.0.0.1
[48:51] Connection established
[48:51] Test passed.
[48:51] Starting: Test 2: Connection through the Proxy Server
[48:51] Authentication was successful.
[48:51] Error : connection to the proxy server was closed unexpectedly.
[48:51] Test failed.
[48:51] Testing Finished.
答案 0 :(得分:0)
要调试转发端口的问题,请先处理Exception in thread "main" 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
message - Invalid or expired token.
code - 89
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=506c3b98 or
http://www.google.co.jp/search?q=1136695b
TwitterException{exceptionCode=[506c3b98-1136695b], statusCode=401, message=Invalid or expired token., code=89, retryAfter=-1, rateLimitStatus=null, version=4.0.4}
事件。
一旦您发现了什么异常(如果有的话),我们可以帮助您。