Dealing with socket timeouts