The first time I use Socket.Send(byte[] data) it does not throw an exception even though the remote host may have closed the connection a long time ago. It only throws an exception on the second attempt to send the data.
I have check and the method does return the correct number of bytes sent. I have also used the overload which takes an out SocketError parameter. This contains SocketError.Success after the call.
Why does the socket not throw an exception on the first call but only on the second.
The “Send” operation is considered complete when the data has been sent to the local TCP/IP stack. It does not guarantee that the data has arrived at the remote side.