catch OSError base class

In python3, socket.error is replaced by a subclass of OSError (pep-3151)