Be careful to sleep for exactly the interval
Reconnect if we lose the socket
More robust connection handling
Set a max buffer size