Recently I stumbled accross an interesting Wikipedia article on the QOTD Protocol. As a part of my C++ programming practice I decided to write a basic implementation of the protocol.
The program reads the quotes from a plaintext file with each quote seperated by an asterisk (*) (this means a quote can contain any character except an asterisk). The first ‘quote’ is actually the number of quotes in the file and is skipped. Once a client connects, the program skips a random number of quotes and then prints the next quote.
I started with a command line program with no networking to test the process of reading the file and picking a quote. Once this worked, I moved on to adding networking capability using the unix socket library. After going through the tutorial at linuxhowtos.org I understood enough of the code to implement it in my own program.