That is correct. Due to the nature of networking and the protocols you use, such disruption can not be detected immediately. If you wait some more, you well get an exception. If you need faster response on network disruption, create some custom mechanism of network testing, base, for example of pinging with the timeout you prefer. See the class
System.Net.NetworkInformation.Ping
,
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx[
^].
Remember, it would be optimistic mechanism, so you need to take care about possible false positives; so your code should be able to handle it.
All you do with networking involved threading, even if you do basic stuff.
Please see my past Answers on the networking threaded design:
Multple clients from same port Number[
^].
This is my collection of references to my past Answers on threading:
How to get a keydown event to operate on a different thread in vb.net[
^].
—SA