Sleep between thoughts when connecting to avoid eating CPU

This uses socket.select for a portable sleep, as described at http://lua-users.org/wiki/SleepFunction