More robust networking, recovers from errors

Still seeing connection errors, but retries eventually recover, so the
client keeps working.