Skip to content

DateMasamune2000/irc_server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal IRC Server

Introduction

This is a simple implementation of the original IRC protocol.

Model

IRC stands for Internet Relay Chat. In its purest form, IRC has completely ephemeral messages: the server is not responsible for keeping a message history or even timestamping messages. The main function of the server is to relay messages sent by one client to its recipients. These recipients can be specified manually for direct messaging, or are determined by the channel that the message is being sent on. Popular chat services Discord and Slack drew inspiration from IRC, and IRC channels and DMs largely play the same role as channels and DMs on these more mainstream platforms.

While this particular server does not support the feature at the moment, IRC also supports relaying messages to other IRC servers. A collection of servers connected this way is called an IRC network, and is how IRC is mostly used today. Popular networks include Freenode and Rizon.

Features

This server supports

  • Channels
  • Direct messages

Support for relaying messages to other servers is planned.

Implementation

  • Tech stack
    • Language: C (with GCC compiler)
    • Libraries: POSIX and C standard library routines for networking, I/O, and dynamic memory
    • Build system: Make
  • Client information is stored in a linked list. This information includes:
    • File descriptors
    • Identification information (nickname, username, hostname)
    • Client state (whether they have just connected, are in the process of registering themselves, or have finished registration and are ready to talk)
  • Channels are implemented as an associative linked list
    • Many-to-many relationship between clients and channels.
  • This server uses select for its I/O multiplexing. This was done for simplicity and better support (MacOS and BSD don't come with epoll), but comes with the following limitations:
    • When any number of clients sends data, the server has to loop over all clients currently connected to determine which one it was
    • select can handle no more than 1024 clients.

How to use

Customize config.h. Then run make.

About

chat program

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors