I think that when the socket invalid, the return value should be -1.
Attach a file by drag & drop or click to upload