I've been trying to make a reliable IRC client for a while now, and I know very little about sockets. I have read the RFC quite a bit, but programmatically responding when appropriate, and detecting errors still boggles me.
How is the program to know the server will send three or four lines before I should send the NICK/USER ?
It seems the only way is to make use of deadline_timers.
I have two failed IRC projects (actually they work, but they aren't good enough to suit me).
One uses boost::ip::tcp::socket's, and the other uses boost::ip::tcp::iostream.
It just seems as if the IRC protocol is a pretty bad one, if it is one at all.
I'm now actually fairly certain it isn't a protocol at all, it just has an RFC and a bunch of implementations, I'd guess the server-end is documented more protocol-ish.
To be clear though, I'm trying to automate the entire process instead of having user interaction like knowing when to send the server a username, etc.
Want to see what I mean?
telnet to irc.freenode.org on port 6667 and it'll send a variable number of lines that differ from server to server, then you need to "register"
type "NICK naruekins" [enter]
"USER naruekins 8 * : Anonymous"
then it sends the MOTD and a bunch of other crap. It just isn't a strictly defined protocol, I'd have to wait a certain length of time after connecting to send my nick/user to make sure it reads all the intro BS so that I can receive and parse the error message (if any).
Also, I'm trying to automate the nick/user registration sequence.