Implemented a keepalive

The clients however will have to tell the server to actually use
this. This is done by sending "10:keepalive\n", 10 being the interval
in seconds. For the keepalive the server will send a single '\n' every
x seconds. If you decide to not use keepalive, at least disable your
read time out on the client side.