views:

98

answers:

1

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?

+2  A: 

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

Al Bundy