Set a timeout on the socket

This may fix #2