WARNING

This is a draft

This project comes with a simple purpose: create from scratch an IRC Client/Server library based on Erlang. This project will help me to revise all basic aspect on Erlang before getting certified soon (I Hope). Why IRC?

IRC (Internet Chat Relay) is a textual protocol. It is pretty old but used a lot by many communities around the world. You already have tons of implementation in practically all languages. You can install and configure client or server in seconds. Definitively, I guess it’s a good choice to revise all Erlang concept!

# A bit of History and Architecture

IRC was standardized in 1993 with RFC1459. Lot of updates was made over time (add new commands, support SSL/TLS and more). IRC protocol use TCP/IP and was developed with distributed systems in mind.

An IRC server is an end-point or entry-point for client or other servers. A client is connected to one server, identified by an unique nickname based on specific rules (Augmented BNF). The server where client is connected need to know the real hostname, the username of the client on the host and the server which the client is connected.

A special client, named Operator, has power to manage server resources and maintenance (e.g. connect/disconnect server). see SQUIT, CONNECT and KILL commands

A channel is a group of one or more clients. This group will receive messages addressed to this channel. Channel names have rules: first character start with & or # and should not contain space, control G or comma character.

# Split complex problem in easy one

# Client connection

IRC use TCP socket and need to maintain its connection to remote server. In Erlang, we’ll use gen_tcp:connect/3 or gen_tcp:connect/4. We can start it with many options but one of them is particularly import in our case: {active, true | false | once | N }.

This option define which part of the code will manage received packets. If we set it to true, all data received will be send as classic Erlang message…

# Augmented BNF

Our parser could be create with yecc or directly with bitstring capabilities. The first method is adapted if you are busy, and need to have a working code rapidly (you can google it and see all existing implementation). The last step is csmore Erlang friendly, and we’ll see more with this one!

# Resources