Set a socket timeout so that the loop can iterate.