catch socket errors to allow reconnects