When I try to connect to freenode using a simple IRC bot in C #, I get the following messages:
: asimov.freenode.net NOTICE *: * Searching for your hostname ...
: asimov.freenode.net NOTICE *: * ID Verification
: asimov.freenode.net NOTICE *: * Could not find your hostname
: asimov.freenode.net NOTICE *: * No Ident response
And then after about 30 seconds, the program terminates.
I tried to send the USER message before the NICK message, and also tried to manually add the carriage return "\ r \ n" to the end of the line instead of specifying StreamWriter in the parameters. Any ideas on other things that might trigger this behavior?
Here is my current code:
socket = new TcpClient(host, port); socket.ReceiveBufferSize = 1024; Console.WriteLine("Connected"); NetworkStream stream = socket.GetStream(); reader = new StreamReader(stream); writer = new StreamWriter(stream) { NewLine = "\r\n", AutoFlush = true }; writer.Write("NICK " + user); writer.Write("USER " + user + " 8 * :" + user); writer.Write("JOIN " + chan); //System.Threading.Thread.Sleep(5000); while(running) { line = reader.ReadLine(); Console.WriteLine(line); }
* * Bugfix - using .WriteLine fixed this. Thanks!
source share