Handle failure cases of Socket.Send. Fixes #3455.
Merge pull request #3480 from pchote/server-fix

Handle failure cases of Socket.Send.