Started transition to game

created a sendmsg function for the client to send messages. Also made
server clean up the buffer better.