tags:

views:

1407

answers:

3

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

+1  A: 

From the tutorials I looked at (like this one), it seems that you are doing it right, except that this

USER Goo * * :Goo

is

USER Goo 0 * :Goo

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.

schnaader
Mmmm, tried. Still got the same error. =/ Thanks though
The.Anti.9
Do you check for PINGs? There seems to be that error message if you do not PONG in registration, also.
schnaader
+2  A: 

Try sending the USER command before the NICK command. What IRC network are you trying to connect to?

"
> telnet irc.freenode.net 6667
NOTICE AUTH :*** Looking up your hostname...
NOTICE AUTH :*** Checking ident
NOTICE AUTH :*** No identd (auth) response
NOTICE AUTH :*** Couldn't look up your hostname
USER x x x x
NICK hwjrh
:kubrick.freenode.net 001 hwjrh :Welcome to the freenode IRC Network hwjrh
:kubrick.freenode.net 002 hwjrh :Your host is kubrick.freenode.net[kubrick.freenode.net/6667], running version hyperion-1.0.2b
"

Works for me; I telnet to Freenode, Undernet and Dalnet all the time...

Tom
Yep, same here, even for roc.esper.net, but after sending NICK you get a PING you have to answer. After that, everything runs fine
schnaader
it's not working for me still. It's still doing what it was doing before. And I'm not getting a PING. It just times out.
The.Anti.9
Perhaps something is wrong with your messages. Do you send a CR/LF at the end of those, too? If possible, try telnet, too, so you can see if even this fails for you.
schnaader
schnaader made a good point. Try sending CR or LF or CR/LF at the end of the line.
Tom
+1  A: 

Telnet for roc.esper.net:

~$ telnet roc.esper.net 6667
Trying 198.247.173.216...
Connected to roc.esper.net.
Escape character is '^]'.
:roc.esper.net NOTICE AUTH :*** Looking up your hostname...
:roc.esper.net NOTICE AUTH :*** Found your hostname
NICK Goo
USER Goo * * :Goo
PING :268966433
PONG :268966433

NICK, USER and PONG were send by me. After that, welcome message follows:

:roc.esper.net 001 Goo :Welcome to the EsperNet Internet Relay Chat Network Goo
:roc.esper.net 002 Goo :Your host is roc.esper.net[198.247.173.216/6667], running version esphyb-1.0.1

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).

schnaader