Catch socket.error before IOError

Since python 2.6 it's a child class.