What will be returned if an NSInputStream object is blocked on read and the TCP connection is closed?
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" ?
精彩评论