none
NetworkStream.Read(). If connection is still open, can it return 0? RRS feed

  • Question

  • I've seen in the documentation that NetworkStream.Read(…) will return 0 if the socket is closed.  But what happens if the socket is still open and the server is just not sending any data?  What would the return value be then?  I guess this is somewhat a moot point given how Read blocks until something can be read but still... 



    Rick

    Thursday, February 21, 2019 5:34 AM

All replies

  • Yes, it's moot.  If the other end doesn't send anything, the Read will not return.  Thus, there can't BE a return value.

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Thursday, February 21, 2019 7:47 AM