2015-01-09 6 views
0

TOR을 사용하여 x 시간 간격으로 ip를 변경하고 Windows 플랫폼에서 C#을 사용하면 누구든지이 문제와 관련하여 도움이 될 수 있습니까 ??토르 C를 사용하여 IP 주소 변경 #

TIA.

는이 코드

public string Refresh() 
{ 
    TcpClient client = new TcpClient("localhost", 9051); 
    string response = string.Empty; 
    string authenticate = MakeTcpRequest("AUTHENTICATE\r\n", client); 
    if (authenticate.Equals("250")) 
    { 
     response = MakeTcpRequest("SIGNAL NEWNYM\r\n", client); 
    } 
    client.Close(); 
    return response; 
} 

public string MakeTcpRequest(string message, TcpClient client) 
{ 
    client.ReceiveTimeout = 20000; 
    client.SendTimeout = 20000; 
    string proxyResponse = string.Empty; 

    try 
    { 
     // Send message 
     StreamWriter streamWriter = new StreamWriter(client.GetStream()); 
     streamWriter.Write(message); 
     streamWriter.Flush(); 

     // Read response 
     StreamReader streamReader = new StreamReader(client.GetStream()); 
     proxyResponse = streamReader.ReadToEnd(); 
    } 
    catch (Exception ex) 
    { 
     // Ignore 
    } 

    return proxyResponse; 
} 

을 시도하고 난 514 인증이 필요한 오류

+0

들어 여기를보십시오 : http://stackoverflow.com/questions/2745268/how-to-use-tor-control-protocol-in-c – danish

답변