After an error, the connection is pretty much shot.
you need to check an error after every send. and you need to block for up to 1 second. 1/2 a second was very sporadic.

I'll write more on the main thread.