Trivial java chatroom client / server
This week I hacked out an extremely trivial chat room client and server in java. The protocol is very close to xmpp, where all messages are in XML and contained within a message tag. The server model is pretty simple: it just rebroadcasts all messages recieved to all users. Eventually some sender confirmation can be added by making the server compare the ‘from’ attribute of the opening message tag with the socket it came from. The server is also single threaded and makes use of Java’s nonblocking i/o facilities for all read/write operations. The code for the client and server are completely separate, so if nothing else the server can be useful for other projects.

