trying to handle socket errors