![]()
::[ MISC 01 - IRC CHAT THRU TELNET
]::[ Printable Version
]::
::[
DISCLAIMER
]::
I will hold no responsibility to whatever happens to you, your computer, your sanity, your pet, or whatever that may happen to your existence for your reading the texts given in each tutorial. So in short, read at your own risk!
A lot of you might be wondering right now why anyone would want to do this. Why not download an IRC client from the Internet? Why bother? Well, this tutorial is obviously not for everyone. The purpose of this tutorial is for the few of us that needs to code an IRC client from scratch and don't know where to start or how to start (perhaps your job requires it, perhaps you just have too much free time). Knowing how to chat in an IRC server through telnet will mean that you could create an IRC client in no time, as long as you're comfortable with sockets already, that is. SideNote: At the time of this writing, I am still quite new to this IRC protocol. I will, of course only be teaching the stuffs I know. :)
The IRC protocol (protocols are like rules) is also known as the RFC 1459. The whole protocol information is found at this website:
http://www.irchelp.org/irchelp/rfc/ Now, that website will inform you that there are four RFCs created as of 2000. They are the Architecture, Channel Management, Client Protocol, and Server Protocol. What we are interested in this tutorial, is the Client Protocol. Why not the Server Protocol? Well, my dear reader, that is because we are trying to learn how to chat thru telnet here, not how to create an IRC server...:) We will be using the telnet command found in every copy of Windows out there (or so I hope :) ). So open up your command prompt and type the following:
telnet Alternatively, you could run telnet thru the Start Menu, then select 'Run', then enter 'telnet' also. :) So you should now have a console window of a telnet program running. Now, in this tutorial, we will be connecting to the official IRC channel of gamedev.net which is at irc.afternet.org, port 6667, channel #gamedev. Now, in the console, we open a connection to the IRC server (irc.afternet.org). Type the following:
open irc.afternet.org 6667 You will then be magically connected to the IRC server. This is, of course, assuming you are connected on the Internet (I'm just making sure...:) ). After opening a connection to the server, you will then probably receive some textual information, don't mind them much. Anyway, after opening a connection, you would want to register yourself to the server. You see, opening a connection just connects you to the server. You're not registered yet as far as the IRC server is concerned. It's like going to a concert hall, you may be there, but you can't get in and enjoy the concert without having a ticket...;). Now, to register for this 'ticket', you type the following commands:
NICK myChatNick USER someName localhost irc.afternet.org :Firstname Lastname Be sure to hit the Enter key after the 'myChatNick' part. The USER and NICK command would like to have their own separate lines you see...;) You may replace the 'myChatNick' with any nickname you want. This is the name that other IRC chatters will see. Now, in the USER command, you can place just about anything in the someName part. The 'localhost irc.afternet.org' part you might want to keep (replace irc.afternet.org with whatever server you're connecting to). The ":Firstname Lastname" is there to tell the world who you are...:). You will notice the colon before the 'Firstname' in the USER command. This is to tell the server that you are giving it a multiple-worded string. Without that colon, the server will only get your Firstname (which will also work :) ). I am telling you this because when we chat later on, you will be using this colon to tell the server that you are chatting more than one word...;) Ok, you should be connected now. If you receive this text from the server:
PING :1431920841 Be sure to type the following:
PONG :1431920841 You will probably get a different number. The PING command is there so you will so the server will not disconnect you (you will get a timeout error, you see :) ). It is important to PONG with the same number that was PING'd to you, by the way. After being connected, you will receive a bunch of texts from the server, welcoming you to the server and informing you of some rules, among others. After everything has settled down, you may now join a channel! :) To join the #gamedev channel, type:
JOIN #gamedev Now that's about as easy as it gets, don't you think so? :) After joining, you are now ready to chat! Woohoo! Is this not exciting? (Ok, so it's not so exciting...but read on anyways...) To send a message to everyone in the channel, you type:
PRIVMSG #gamedev :HELLO world! Now everyone will receive the text 'HELLO world!' on their IRC client. Isn't that cool? :) You will probably have quite a bit of a difficult time deciphering who you are chatting though. Remember, you're also receiving IRC commands (you're acting as an IRC client app...:) ). When other chatters on the same channel sends a message to the channel, you will receive something like:
:someChatterName!someName@someAddress.net PRIVMSG #gamedev :Hi also! The obvious part is the "Hi also!" string, that is what another chatter said. Now deciphering the other parts... someChatterName is the nickname of the chatter that said "Hi also!". After the chatter's nickname is an exclamation point, after it is someName. This is the 'someName' in the USER command, except this someName is the someName that person provided, not yours ;) And then an @ sign is found, then someAddress.net is followed by the @ sign. These someAddress.net are usually quite long, and don't usually end in ".net" :) And that's it! Simple! You don't have to download or pay any IRC chat software! You can chat through telnet! Haha, be mighty proud and boast of this to your friends who you think won't think you're strange for not just downloading an IRC client like MIRC...;) Anyway, if you want to quit from a channel, just use the command (you've probably guessed it):
QUIT So what use is this chatting through telnet? What's the whole point of this tutorial? Well, if you know sockets programming, by now you'll know how to start creating a simple IRC client application. You just create a socket connection to the server, then send string messages to the server and respond accordingly to its responses! :) Oh yeah, more commands can be found at:
http://www.irchelp.org/irchelp/rfc/chapter4.html Just follow it and you'll be an expert on it in no time! :) That's it! Hope you enjoyed this tutorial!
Now this ends my first miscellaneous tutorial. I hope you find the information here useful.
|
|