Catch socket.error exceptions as seen in issue #20