I'm making a simple IRC Bot in C. And I finally got the bot connecting and receiving information. My code is supposed to be sending as well, but the server is acting as if it is not sending anything. When The bot connects, I receive this:
Recieved: :roc.esper.net NOTICE AUTH :*** Looking up your hostname...
Recieved: :roc.esper.net NOTICE AUTH :*** Found your hostname
at which point my code sends this:
Sent: NICK Goo
Sent: USER Goo * * :Goo
I determined from using wireshark that this is the registration you should send after the initial connect. However, I'm not sure the data is actually sending or maybe it is invalid somehow? Because after about 30 seconds of nothing i also receive this:
Recieved: ERROR :Closing Link: c-68-33-143-182.hsd1.md.comcast.net (Registration timed out)
And then my program closes.
Does anyone else know anything about the programatic auth/registration processes in irc? Or does anyone else have any helpful ideas at all?
Thanks
** EDIT ** Fixed. I needed to be sending line terminators at the end of each line. \r\n
Try sending the USER command before the NICK command. What IRC network are you trying to connect to?
Works for me; I telnet to Freenode, Undernet and Dalnet all the time...
Telnet for roc.esper.net:
NICK, USER and PONG were send by me. After that, welcome message follows:
And so on...
So, again, check for PING-PONG and if your messages are sent correctly (especially CR/LF or '\n' at end).
By the way, I get "registration timed out" if I don't send any of the messages, even if PONG is missing, but once I answered PING, there is no timeout anymore (at least not after 30 seconds).
From the tutorials I looked at (like this one), it seems that you are doing it right, except that this
is
in all the tutorials I saw. Also, don't forget the PING-PONG later on, but this should not be needed for registration (EDIT: It seems that this is wrong and PONG is needed right after you send NICK).
I guess you know about RFC 1459, which will also help you a lot with this.