Skip to content

Instantly share code, notes, and snippets.

@Noxwizard
Created April 22, 2022 03:24
Show Gist options
  • Save Noxwizard/e8f11197ef5f4495fa1265a84e91eb82 to your computer and use it in GitHub Desktop.
Save Noxwizard/e8f11197ef5f4495fa1265a84e91eb82 to your computer and use it in GitHub Desktop.

IRC Server

Goal: Create an IRC server which existing IRC clients can successfully connect to, create channels on, and chat on. Concepts: Sockets, multi-threading

RFCs

Original: https://tools.ietf.org/html/rfc1459 - At least read for some of the overview and section 2 Client Protocol: https://tools.ietf.org/html/rfc2812 - Will tell you how a client communicates to a server Reference Material: http://chi.cs.uchicago.edu/chirc/irc_examples.html

Recommended Implementation Languages: python, C++

Requirements

The server shall:

  • Accept any number of users
  • Allow users to create channels
  • Allow users to join channels
  • Allow users to change their nickname
  • Allow users to send messages to channels
  • Allow users to send messages to other users
  • Prevent users with the same nick from connecting
  • Be multi-threaded

The server does not need to worry about:

  • Encryption
  • Server to server communication
  • User account management (e.g. passwords, nickname registration)
  • Channel modes
  • User modes
  • Most channel commands aside from messages (e.g. kicking, banning, mode changes)

Testing

Install an IRC client and connect to your server. We do not currently have any Windows clients on the share, but both CentOS and Ubuntu have IRC clients available (hexchat and xchat).

Make sure you can create and join a channel.

Make sure other users can join the channel and receive the messages.

Make sure you can send messages to other users.

Suggestions

Make an initial implementation and then rewrite it in C or C++. That way, socket communication, strings, and multi-threading works between the two languages is different enough that it's good practice to learn both, while still being able to use a similar design to implement it in both languages.

Install an IRC server and client in a VM and use Wireshark to capture the traffic if you are ever unsure how the messages need to be formed. On CentOS, you can install xchat as a client and ngircd as a IRC server. On Ubuntu, xchat-gnome or hexchat are available clients.

Don't look for example code online. Most are large, fully fledged IRC servers and will be too large to get anything useful from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment