* Split common functionality from client code * Clean up client code and use proper defines for constants * Implements the channel code to read/write server side messages.