Preface to writing an IRC client in VB - Revised (August 29th, 1997)
-------------------------------------------------------------------------

I. Introduction
	I've spent many hours in the #visualbasic channel on EFNet IRC,
and I am a regular operator there. The most common question, or topic of
programming that I am faced with is how to write an IRC client. It seems
as though almost everyone wants to write an IRC client, but most have
trouble getting started or get stuck later on.

        The IRC RFC (Request for Comments, RFC1459.TXT) often puzzles the
average programmer in VB. Which is understandable, when I first started
programming, at the age of 12, I wanted to jump right in to huge projects
that were way over my head. So anyone wanting to write an IRC client, my
first advice to you is to learn VB programming, and especially how to
deal with strings. Next I STRONGLY suggest you read the IRC RFC. However,
since many of you are so anxious to get your feet wet, this document and
included example should help you understand how IRC works as well as get
started on your first IRC program.

II. The IRC Protocol/Brief overview of IRC

	What is a protocol anyway? The best explanation I can give of a
protocol is this; a protocol is a defined set of guidelines for behavior.
Specifically when we talk about protocol in relation to IRC, we mean the
different strings sent across the internet carrying messages that build
the entire IRC network.

	The IRC RFC describes the protocol used in order to make either
a client or server on the IRC network. Again, I strongly suggest you read
the IRC RFC document. I will try and give you a brief overview of what
happens on IRC, and then we'll jump right in to the details.

	First of all, the client chooses a host server to connect to, and
then which port. The adopted standard port is 6667, but many IRC servers
support this and other ports. Developing an IRC client of any type can
be annoying to the IRC servers, and could get you banned. I strongly
suggest you find a private IRC server to test on and get permission to do
so.

	The client then makes a request for a connection. The server
opens a connection, and there is now a logical connection between the
client and the server. The details of how this works is not really
important at this point. At first the connection will appear dead, or
silent. The server will send nothing, it is up to you, the client, to take
the first step. You must register with the IRC server in order to get
online. This is typically done in the fashion of NICK, then USER.

	Once the client has registered, and if all goes well is logged on,
the IRC server will send login information such as the server name,
number of users, and most importantly the MOTD (Message Of The Day). Each
message must comply with the protocol for IRC. Once the client is logged
on, it can then send commands to the server, and the server will respond.
Now that you understand the basic idea of how the client and server
"shake hands" in the beginning, we can jump in to the details.

III. Let's get connected!

	Before we go any further, you must understand the basic concepts
of VB, and how it works. If you don't, read no further. We are going to
assume that you have a Winsock component installed in VB, may I suggest
an excellent component from Dolphin Systems called dsSocket, available via
Shareware directly from their web site, http://www.dolphinsys.com. This is
a small, and easy to use OCX for 32-bit. If you haven't already, take a
little time and read the documentation that comes with it, and look over
the examples.

	Look through the included example and read every part of it. You
can run it and get on IRC to check it out. This example was written in
VB4 Pro and uses dsSocket. You may use any of the code from this program
for whatever purposes you like, free or commercial. The only thing I ask
is that you give credit where it is due.

	Before reading through this, you should probably open up your VB
manual or help file and brush up on some commands. Get to know the mid$,
left$, right$, instr(), len(), etc. commands. Just know strings really
well and you'll do fine. If not, you'll probably struggle.

	Keep in mind one thing when your running this program, or
reading through it. This is an example ONLY, not a full client. There is
very little error checking, and it is only capable of the most basic chat
functions. Anything further you need to add on your own. This is just to
give you a basic idea of programming IRC and hopefully get you started on
your own, more advanced client.

IV. Legal Information

	Dann M. Daggett II, the author of this program, IRCPre3, is not
responsible for any damage this code or program may cause by the use or
misuse of this product. There is a very small chance that this program
will do anything wrong, and if it does, you probably caused it. =)
Hopefully you have enough background now in order to start writing your
first IRC program. I hope the example helps and good luck!

IV. Reference/Credits

The IRC RFC is RFC1459.TXT, and is available at:
  ftp://ds.internic.net/rfc/rfc1459.txt

The Winsock control, dsSocket is available at:
  ftp://www.dolphinsys.com/pub/VBasic/dssk170d.exe

Author Information
-------------------------------------------------------------------------
Name	 : Dann M. Daggett II
Nickname : Dasmius
Channel  : #VisualBasic
IRC Net  : EFNet
E-mail   : danny@telecomputer.com

V. Copyright Information

dsSocket is Copyright 1995, 1996 - Dolphin Systems Inc.
MSICP and Visual Basic is  1996 Microsoft Corporation
WinZip is a registered trademark of Nico Mak Computing, Inc.
All other material is Copyright by their respective owners. 

This document and example files are Copyright (C) 1997 by Dann M. Daggett II.
All Rights Reserved.