Second commit. Fixed a bug that allowed clients to write to sockets out of turn.