C# Networkstream.read()

后端 未结 3 1907
忘了有多久
忘了有多久 2021-02-08 11:48

How does read(buffer, offset, length) actually work, if i pass the length to read as 32, does that mean that it would keep blocking till it receives the 32 bytes?

I unde

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-08 12:16

    The question about the timeout would appear to still be unanswered.

    The answer is that you can set stream.ReadTimeout and stream.WriteTimeout, where stream is your NetworkStream object. This handles the blocking case of no response at all. Without setting these values, the stream will wait indefinitely.

提交回复
热议问题