socket.error is a subclass of IOError since 2.6.