此代码失败:
public bool generateNewIdentity()
{
TCPClient torIdentityClient = new TCPClient();
torIdentityClient.OnConnect += delegate ()
{
torIdentityClient.Write("AUTHENTICATE \"*********************************\"\r\nSIGNAL NEWNYM\r\n");
};
torIdentityClient.OnRead += delegate (TCPClient tcpClient, string[] dataReadArray)
{
if(dataReadArray[0] == "250 OK")
{
return true;
}
};
torIdentityClient.Delimiter = "\r\n";
torIdentityClient.Connect("127.0.0.1", 9151);
}
返回包含["250 OK", "250 OK"]
它给我的例外是Anonymous function converted to a void returning delegate cannot return a value
。
我试图让它返回true,如果它得到250 OK。
如何解决此问题?