I assume you know what IRC is, but who was the creator of IRC? Well, the creator of IRC was Jarkko Oikarinen from Finland. His first IRC server and client were released in 1988 and the first IRC server was tolsun.oulu.fi. In the beginning the IRC protocol was a lot simpler then it is now (I.E: no ChanServ or NickServ etc). Since then IRC has come a long way and at the moment there are a lot of RFC-s (Request for Comment) concerning IRC. In this tutorial I will talk about and explain a bit about RFC 1459 - the original RFC for IRC. In case you want to know more about IRC protocol then all the RFC-s concerning IRC are available here or from the rfc-editor.org homepage.
An IRC network consists of many servers linked together. For example, let's say we have three IRC servers: A, B and C. They are linked together so that A is linked to B and B is linked to C, but A is not directly linked to C. Now we have three users who are connected to those servers, users 1, 2 and 3. Users 1 is connected to server A, user 2 is connected to server B and user 3 is connected to server C. Now it's time to explain how things work in IRC.
### Private Messages ###
Let's say user 1 wanted to send a private message to user 2. The text he has to send to the server is:
PRIVMSG 2 :hi there
(whenever text is longer then one word there has to be a : in front of it, if not, only the 1st word will be sent). This is the raw text that is sent to the server and it has been made simpler in IRC clients (/msg nick text), but when IRC-ing with telnet or writing your own client then this is the text that has to be sent. You can try this in your IRC client using /raw or /quote. OK, now back to private messages.
When user 1 types this command the text is first sent to server A, then server A sends it to server B and finally server B sends the text to user 2.
If user 3 wants to send a private message to user 1, then the messages goes to server C first, then to server B, then to server A and finally server A sends the message to user 1.
In this case there are only 3 servers involved, but there are a lot more servers in big IRC networks, which means that the message could travel through 10 different servers before reaching it's destination. So private messages are not really that private! (unless DCC chatting)
### Channel Messages ###
What if user 1 wanted to send a message that user 2 and 3 could see at the same time?
For that they all have to be on the same channel, let's say they all want to join #zzine. To join a channel in IRC you have to type the following:
JOIN #channel
(In this example JOIN #zzine)
Now that they have all joined #zzine they can all receive messages which are addressed to that channel. To send a message to a channel user has to type the following
PRIVMSG #channel :text
In our example user 1 has to type something like this:
PRIVMSG #zzine :hey guys!
Now both users 2 and user 3 will see that message.
### PING & PONG ###
Ping is a way of checking if a user is still online and if he can be reached. Usually the server does that. If user 1 sees a message ping :3216541 or in some cases ping :127.0.0.1 he has to respong with a pong :3216541 or pong :127.0.0.1. This is different on different servers, some servers send the ping with a sequence number and some with the IP of the user. The user has to respond with a pong in a certain amount of time, if he doesn't he will be disconnected from the server. This is used for making sure that there are no dead-nicknames hanging around in channels two weeks later after the actual user has left.
### Conclusion ###
Basicly that's the way IRC works, I don't see a point in re-writing the entire RFC and I think this should be enough to get an idea about the IRC protocol. If you need more information there are always RFC-s ;)