在获得新的TOR电路时,“已建立的连接被主机中的软件中止”

时间:2017-06-21 14:36:26

标签: c# .net sockets tor

我有一个在TOR上成功使用TOR的.NET应用程序。将TOR更新到6.5.2版之后。我无法刷新我的TOR IP。以下是我目前使用的代码:

Socket server = null;
        try
        {
            IPEndPoint ip = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 9151);
            server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            server.Connect(ip);
            // Please be sure that you have executed the part with the creation of an authentication hash, described in my article!
            server.Send(Encoding.ASCII.GetBytes("AUTHENTICATE \"password\"" + Environment.NewLine));
            byte[] data = new byte[1024];
            int receivedDataLength = server.Receive(data);
            string stringData = Encoding.ASCII.GetString(data, 0, receivedDataLength);
            server.Send(Encoding.ASCII.GetBytes("SIGNAL NEWNYM" + Environment.NewLine));
            data = new byte[1024];
            receivedDataLength = server.Receive(data);
            stringData = Encoding.ASCII.GetString(data, 0, receivedDataLength);
            if (!stringData.Contains("250"))
            {
                Console.WriteLine("Unable to signal new user to server.");
                server.Shutdown(SocketShutdown.Both);
                server.Close();
            }
        }
        finally
        {
            server.Close();
        }

当它到达行

receivedDataLength = server.Receive(data);

应用程序中断消息System.Net.Sockets.SocketException:'已建立的连接被主机中的软件中止'

有人知道发生了什么事吗?或者找到问题的任何提示?

提前致谢

0 个答案:

没有答案