handle socket errors and the like.