How long will NetworkStream Read wait, before dying?
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?
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 :)
精彩评论