If you're going to write the program from the beginning, you probably also want to take a look at how sockets work on Linux (BSD sockets), possibly how threads work (POSIX threads), and so on. The result depends a bit on which language you're writing it in - maybe C or C++ would be good, it depends a little.
I just wrote a chatting system (a client and a server) as a sort of homework..well it's not actually 100% ready yet, but the main parts work (connecting, disconnecting, chatting, ...) And if this is your homework, you should mention it right away
You can also take a look at already-written programs (irssi, epic, ...) too if you find any help there. In the beginning the best advice I can give is that you should first design the program trough and then start writing it, possibly re-thinking the design if you face problems. The actual code isn't difficult to write (it seems in the end), but to get the pieces work in a sane way is far more complicated.