What conditions cause NetworkStream.Write to block?

后端 未结 3 1674
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 00:13

Will NetworkStream.Write block only until it places the data to be sent into the TCP send buffer, or will it block until the data is actually ACK\'d by the rece

3条回答
  •  轮回少年
    2020-12-18 00:26

    TcpClient.Write will block until the packet buffer has been flushed to the network and the appropriate ACK(s) have been received. You'll notice that a dropped connection will usually end up throwing an exception on the Write operation, since it waits for the ACK but doesn't get one within the defined timeout period.

提交回复
热议问题