I will provide source code of a chat server written in C, its basically a slimmed down version of an IRC server that has a single chat room.
The code is threaded and currently coded as follows.
1 thread managing connections
2 threads managing reading of sockets via select()
4 writer threads
The threads communicate with each other via mutexes and queues and a hash table is used for looking up usernames and finding the appropriate client.
Features that currently work:
Client Connecting
Client Setting Nickname
Messaging Room
Private Messaging between users
Things that need sorted:
Memory leak when client exits.
Memory leak when program ends, threads are not properly destroyed.
Apparently Invalid Memory read error that appears through valgrind but no obvious error exists.
Features that need added:
User Manager thread needs to sort out PING to make sure users are still there and the socket has not been lost.
Allow multiple rooms with these conditions:
1. Users can not change rooms once they join
2. Usernames are unique per room (eg. There can be 2 UserX's as long as they are in seperate rooms)
## Deliverables
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Deliverables must be in ready-to-run condition, as follows (depending on the nature of the deliverables):
a) For web sites or other server-side deliverables intended to only ever exist in one place in the Buyer's environment--Deliverables must be installed by the Seller in ready-to-run condition in the Buyer's environment.
b) For all others including desktop software or software the buyer intends to distribute: A software installation package that will install the software in ready-to-run condition on the platform(s) specified in this bid request.
3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement).
## Platform
This is an ANSI C program, it currently works on Linux and OS X, this should not change.