Reputation: 19824
I have a call to Read
on NetworkStream
objeck, which uses Socket.Receive
internally.
Say that no data is comming in. How long before the Read Method exits?
ReceiveTimeout
is set to 0 (infinite timeout).
What if I unplug the internet cable? Will it exit?
Upvotes: 2
Views: 586
Reputation: 14099
If you unplug the cabel you will get IOException. You'll get this exception if socket is closed on the other end.
You might get an ObjectDisposedException if there is a network problem. More info in this MSDN article.
Otherwise it might run for around 8 years, as Hans pointed out :)
Upvotes: 2