I think that the socket is invalid, the return should be -1.
Merge pull request #352 from ranzhengyuan/some-idea

I think that when the socket invalid, the return value should be -1.