When I try and connect to freenode using a simple IRC bot in C#, I get the following messages:
:asimov.freenode.net NOTICE * :* Looking up your hostname...
:asimov.freenode.net NOTICE * :* Checking Ident
:asimov.freenode.net NOTICE * :* Couldn't look up your hostname
:asimov.freenode.net NOTICE * :* No Ident response
And then after about 30 seconds, the program terminates.
I have tried sending the USER message before the NICK message, and also have tried manually appending the carriage return "\r\n" to the end of the line instead of specifying it in the StreamWriter options. Any ideas as to other things that might cause 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);
}
**Fixed - using .WriteLine fixed it. Thanks!