开发者

What will be returned if an NSInputStream object is blocked on read and the TCP connection is closed?

开发者 https://www.devze.com 2023-03-27 16:28 出处:网络
Suppose a thread is blocked on the read method of the NSInputStream object of a TCP connection, and the connection is closed from the other side. What will happen ? Will the method return with a value

Suppose a thread is blocked on the read method of the NSInputStream object of a TCP connection, and the connection is closed from the other side. What will happen ? Will the method return with a value ? Will the value be zero or negative ?

The doc here says this:

开发者_Python百科
A positive number indicates the number of bytes read;
0 indicates that the end of the buffer was reached;
A negative number means that the operation failed

Is that a typo in the doc for value 0 ? Should it be "0 indicates end of stream was reached" ?

0

精彩评论

暂无评论...
验证码 换一张
取 消