Make sure to also catch socket.error. Fixes #87