home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / Free / Prg / irc-code.exe / IRCPRE2.TXT < prev    next >
Encoding:
Text File  |  1996-10-21  |  5.3 KB  |  106 lines

  1. Preface to writing an IRC client in VB - Revised
  2. -------------------------------------------------------------------------
  3.  
  4. I. Introduction
  5.     I've spent many hours in the #visualbasic channel on efnet IRC,
  6. and I am a regular operator there. The most common question, or topic of
  7. programming that I am faced with is how to write an IRC client. It seems
  8. as though almost everyone wants to write an IRC client, but most have
  9. trouble getting started or get stuck later on.
  10.  
  11.         The IRC RFC (Request for Comments, RFC1459.TXT) often puzzles the
  12. average programmer in VB. Which is understandable, when I first started
  13. programming, at the age of 12, I wanted to jump right in to huge projects
  14. that were way over my head. So anyone wanting to write an IRC client, my
  15. first advice to you is to learn VB programming, and especially how to
  16. deal with strings. Next I STRONGLY suggest you read the IRC RFC. However,
  17. since many of you are so anxious to get your feet wet, this document and
  18. included example should help you understand how IRC works as well as get
  19. started on your first IRC program.
  20.  
  21. II. The IRC Protocol/Brief overview of IRC
  22.  
  23.     What is a protocol anyway? The best explanation I can give of a
  24. protocol is this; a protocol is a defined set of guidelines for behavior.
  25. Specifically when we talk about protocol in relation to IRC, we mean the
  26. different strings sent across the internet carrying messages that build
  27. the entire IRC network.
  28.  
  29.     The IRC RFC describes the protocol used in order to make either
  30. a client or server on the IRC network. Again, I strongly suggest you read
  31. the IRC RFC document. I will try and give you a brief overview of what
  32. happens on IRC, and then we'll jump right in to the details.
  33.  
  34.     First of all, the client chooses a host server to connect to, and
  35. then which port. The adopted standard port is 6667, but many IRC servers
  36. support this and other ports. Developing an IRC client of any type can
  37. be annoying to the IRC servers, and could get you banned. I strongly
  38. suggest you find a private IRC server to test on and get permission to do
  39. so.
  40.  
  41.     The client then makes a request for a connection. The server
  42. opens a connection, and there is now a physical connection between the
  43. client and the server. The details of how this works is not really
  44. important to you. At first the connection will appear dead, or silent.
  45. The server will send nothing, it is up to you, the client, to take the
  46. first step. You must register with the IRC server in order to get on-line.
  47. This is typically done in the fashion of NICK, then USER.
  48.  
  49.     Once the client has registered, and if all goes well is logged on,
  50. the IRC server will send login information such as the server name,
  51. number of users, and most importantly the MOTD (Message Of The Day). Each
  52. message must comply with the protocol for IRC. Once the client is logged
  53. on, it can then send commands to the server, and the server will respond.
  54. Now that you understand the basic idea of how the client and server
  55. "shake hands" in the beginning, we can jump in to the details.
  56.  
  57. III. Let's get connected!
  58.  
  59.     Before we go any further, you must understand the basic concepts
  60. of VB, and how it works. If you don't, read no further. We are going to
  61. assume that you have a winsock component installed in VB, may I suggest
  62. an excellent component from Microsoft called the Internet Control Pack,
  63. its free, and for VB4! If you haven't already, take a little while and
  64. read the help file that comes with it, and look over the examples.
  65.  
  66.     Look through the included example and read every part of it. You
  67. can run it and get on IRC to check it out. This example was written in
  68. VB4 Pro and uses MS ICP. You may use any of the code from this program
  69. for whatever purposes you like, free or commercial. The only thing I ask
  70. is that you give credit where it is due.
  71.  
  72.     Before reading through this, you should probably open up your
  73. VB manual or help file and brush up on some commands. Get to know the
  74. mid$, left$, right$, instr(), len(), etc. commands. Just know strings
  75. really well and you'll do fine. If not, you'll probably struggle.
  76.  
  77.     Keep in mind one thing when your running this program, or
  78. reading through it. This is an example ONLY, not a full client. There is
  79. very little error checking, and it is only capable of the most basic chat
  80. functions. Anything further you need to add on your own. This is just to
  81. give you a basic idea of programming IRC and hopefully get you started on
  82. your own, more advanced client.
  83.  
  84.     Oh yea, and I am not responsible for any damage this code may
  85. cause, blah blah, you know that crap. Its not gunna do anything, I would
  86. almost guarantee it, and if it does, you probably caused it. =) Hopefully
  87. you have enough background now in order to start writing your first IRC
  88. program. I hope the example helps and good luck!
  89.  
  90. IV. Reference/Credits
  91.  
  92. The IRC RFC you want is RFC1459.TXT and is available at ds.internic.net,
  93.   via FTP in the /RFC directory.
  94.  
  95. The Microsoft Internet Control Pack is available at
  96.   http://www.microsoft.com/icp
  97.  
  98. Author Information
  99. -------------------------------------------------------------------------
  100. Name     : Dann Daggett II
  101. Nickname : Dasmius
  102. Channel  : #VisualBasic
  103. E-mail   : danny@telecomputer.com
  104.  
  105. This document and example are Copyright (C) 1996 by Dann Daggett II
  106.