Using the code:
Dim client As New System.Net.Sockets.TcpClient()
client.ReceiveTimeout = 250
client.SendTimeout = 250
client.Connect(New System.Net.IPEndPoint(New System.Net.IPAddress({***, ***, ***, ***}), *****))
Assert.IsTrue(client.GetStream.CanTimeout)
Try
While True
Dim sent As Integer = client.Client.Send({0})
System.Threading.Thread.Sleep(100)
' Cable is physically disconnected while this loop is active.
End While
Catch ex As Exception
End Try
It takes 18 seconds for the loop to be aware of a hard disconnection. How could it take so long given the timeout is 250 ms?