Handle failure cases of Socket.Send.

Fixes #3455.