开发者

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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜