A Console IRC Bot


I'm planning to write some articles based on questions I get from fellow students. The first one is how to get on IRC with C#? . So, here it is, the first article of (hopefully) many.

Let's start by telling what IRC is. This is best done by reading the Internet Relay Chat Protocol RFC. You can find anything you want about the IRC protocol in there.

Getting on IRC is as simple as:

  • Establishing a connection.
  • Logging in.
  • Maintaining a connection and reacting to commands.

As this is an article on how to establish an IRC connection and work with the commands, I'm not going to spent any time on UI. Therefore this will be a simple Console Application ( cIRC ).

We'll make a seperate class for the IRC functions so we could re-use it later when we want to add a UI.

using System;
using System.Net;
using System.Net.Sockets;
using System.IO;

namespace System.Net {
      public class IRC {

      } /* IRC */
} /* System.Net */

You might also like...



Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”