end of stream vs !DataAvailable

  • Thread starter Thread starter Ryan Liu
  • Start date Start date
R

Ryan Liu

Hi,

For NetworkStream,
what is difference between
ReadByte() return -1 indicates "end of stream"

and DataAvailable = false?

Thanks a lot!
 
Ryan Liu said:
For NetworkStream,
what is difference between
ReadByte() return -1 indicates "end of stream"

and DataAvailable = false?

I *believe* DataAvailable can return false even if the stream isn't
finished. For instance, if you've got an open network connection but
the other end hasn't sent anything, DataAvailable will return false,
but ReadByte will block until it gets more data (or the other end
closes the connection).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top