Click here to Skip to main content
11,935,012 members (53,921 online)
Click here to Skip to main content
Add your own
alternative version


54 bookmarked

SmartIrc4net - the C# IRC library

, 19 Sep 2004
Rate this:
Please Sign up or sign in to vote.
IRC library for .NET.


I wrote SmartIrc4net for having a high-level IRC API for .NET/C#. I started long time ago with IRC programming for PHP, I wrote Net_SmartIRC. Net_SmartIRC is a PEAR class. Later, I was disappointed that the OO features of PHP are so limited. I was starting to port the project to C++, after a few weeks I stopped, so many things are missing and have to be written (even simple things like string manipulation). Then I found C#. And I ported SmartIRC in about 1-2 weeks! After that the API got better and better, it's just great what it is now... so here we are SmartIrc4net.

Object Design

This library has a 3 layered API, allows developers to pick the layer/features he needs. You could use any layer for writing IRC applications, the question is how much IRC abstraction and features you need. You have the choice!

Layer 1: IrcConnection

This layer is a low-level API and manages the messagebuffer (for reading and writing). Also, the ping/pong and connection handling is done.

Layer 2: IrcCommands (extends IrcConnection)

This layer is a middle-level API. It contains all IRC RFC commands plus some useful and easy to use IRC methods (like Op, Deop, Ban, Unban etc.).

Layer 3: IrcClient (extends IrcCommands)

This layer is a high-level API with all features you could need for IRC programming, like channel syncing (keeping track of channels in objects with modes/topic/users), user syncing (for nicks, indents, hosts, realnames, servers, and hopcounts). This layer is fully event driven, all received data is parsed into different events with special arguments for each event (this makes it very easy to use the received IRC data without checking each time the RFC!)

How to use SmartIrc4net

Here is an example of how to use the library using the high-level API:

using System;
using System.Collections;
using Meebey.SmartIrc4net;
using Meebey.SmartIrc4net.Delegates;

public class Test
    public static IrcClient irc = new IrcClient();

    public static void OnQueryMessage(Data ircdata)
        switch (ircdata.MessageEx[0]) {
            case "join":
            case "part":
            case "say":
                irc.Message(SendType.Message, MessageEx[1], MessageEx[2]);

    public static void Main(string[] args)
        irc.SendDelay = 200;
        irc.AutoRetry = true;
        irc.ChannelSyncing = true;
        irc.OnQueryMessage += new MessageEventHandler(OnQueryMessage);

        string[] serverlist;
        serverlist = new string[] {""};

        int    port   = 6667;
        if(irc.Connect(serverlist, port) == true) {
            irc.Login("SmartIRC", "Stupid Bot");
            irc.Message(SendType.Message, "#smartirc", "test message");
            irc.Message(SendType.Action, "#smartirc", " thinks this is cool");
            irc.Message(SendType.Notice, "#smartirc", "SmartIrc4net rocks!");
        } else {
            System.Console.WriteLine("couldn't connect!");

Connect to your favorite IRC server, set the IRC server in the source. Join the #smartirc channel. Compile the source, spawn the bot. The bot should come and say three messages, after that send him a private message: "/msg smartirc say #smartirc hello!".

Official Project Page

SmartIrc4net is an own project which you can find here. There you get the current versions, can report bugs or post help requests on the forum. Comments, suggestions and criticism are welcome!

Have fun

There you go, have fun with bot coding! Wink | ;)


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Germany Germany
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionHow to stop listening to the server? Pin
Member 1021809125-Aug-13 20:55
memberMember 1021809125-Aug-13 20:55 
QuestionMutliple-Users for AJAX Chat Pin
Member 807251619-May-12 0:42
memberMember 807251619-May-12 0:42 
GeneralMy vote of 1 Pin
xComaWhitex6-Jan-11 23:28
memberxComaWhitex6-Jan-11 23:28 
QuestionC# Application instead of console? Pin
Levisaxos9-Nov-09 4:38
memberLevisaxos9-Nov-09 4:38 
GeneralStill not working... Pin
supra5619-Jul-07 6:08
membersupra5619-Jul-07 6:08 
GeneralVoice Conference-HELP PLZ!! Pin
mfc_surfer12-Jun-07 4:21
membermfc_surfer12-Jun-07 4:21 
GeneralRe: Voice Conference-HELP PLZ!! Pin
meebey12-Jun-07 4:30
membermeebey12-Jun-07 4:30 
GeneralRe: Voice Conference-HELP PLZ!! Pin
mfc_surfer13-Jun-07 0:04
membermfc_surfer13-Jun-07 0:04 
GeneralRe: Voice Conference-HELP PLZ!! Pin
farzade14-Oct-07 20:39
memberfarzade14-Oct-07 20:39 
GeneralRe: Voice Conference-HELP PLZ!! Pin
CompMan4423-Aug-08 22:12
memberCompMan4423-Aug-08 22:12 
GeneralIRC Server Pin
mfc_surfer10-Jun-07 23:02
membermfc_surfer10-Jun-07 23:02 
GeneralRe: IRC Server Pin
farzade14-Oct-07 20:55
memberfarzade14-Oct-07 20:55 
Questionhow do I compile this? Pin
V32546-Apr-07 4:03
memberV32546-Apr-07 4:03 
AnswerRe: how do I compile this? Pin
meebey6-Apr-07 5:45
membermeebey6-Apr-07 5:45 
GeneralRe: how do I compile this? Pin
Member 1115323314-Oct-14 9:08
memberMember 1115323314-Oct-14 9:08 
AnswerRe: how do I compile this? Pin
Yeorwned11-May-09 9:18
memberYeorwned11-May-09 9:18 
Questionother english language can support ? Pin
abcomp0120-Nov-06 21:53
memberabcomp0120-Nov-06 21:53 
Questioncan through NAT? Pin
iamcoder28-Apr-06 0:18
memberiamcoder28-Apr-06 0:18 
AnswerRe: can through NAT? Pin
meebey28-Apr-06 1:25
membermeebey28-Apr-06 1:25 
GeneralRe: can through NAT? Pin
iamcoder28-Apr-06 22:07
memberiamcoder28-Apr-06 22:07 
GeneralRe: can through NAT? Pin
meebey29-Apr-06 2:39
membermeebey29-Apr-06 2:39 
GeneralRe: can through NAT? Pin
iamcoder29-Apr-06 18:01
memberiamcoder29-Apr-06 18:01 
GeneralExample has few errors. Pin
chmod222225-Jan-06 0:07
memberchmod222225-Jan-06 0:07 
GeneralUpdated Article Pin
meebey16-Jan-05 8:27
membermeebey16-Jan-05 8:27 
GeneralHesh wants DCC! :P Pin
FocusedWolf28-Sep-04 3:54
sussFocusedWolf28-Sep-04 3:54 
Generalbugs in the example Pin
meebey26-Sep-04 11:21
membermeebey26-Sep-04 11:21 
GeneralRe: bugs in the example Pin
meebey20-Nov-04 4:17
membermeebey20-Nov-04 4:17 
GeneralNo Source Pin
Rev_Fry19-Sep-04 8:40
memberRev_Fry19-Sep-04 8:40 
GeneralRe: No Source Pin
Rev_Fry19-Sep-04 8:41
memberRev_Fry19-Sep-04 8:41 
GeneralRe: No Source Pin
Uwe Keim19-Sep-04 19:41
sitebuilderUwe Keim19-Sep-04 19:41 
GeneralRe: No Source Pin
meebey20-Sep-04 9:35
membermeebey20-Sep-04 9:35 
GeneralRe: No Source Pin
meebey20-Sep-04 9:34
membermeebey20-Sep-04 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.151126.1 | Last Updated 19 Sep 2004
Article Copyright 2004 by meebey
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid