1

This code fails:

    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);
    }

It's being returned a string array containing ["250 OK", "250 OK"]

The exception it is giving me is Anonymous function converted to a void returning delegate cannot return a value.

I am trying to make it return true, if it gets 250 OK.

How can I resolve this issue?

0 Answers0