recv() 方法什么时候返回 0?

When is recv() method returning 0?

有人可以解释 recv() 方法何时 returning 0 吗?当然提供了比 0 字节长的缓冲区。方法是阻塞的,所以它应该等到它收到某些东西或抛出错误并且 return -1。我有标志 - 0 集。不是非阻塞模式。

MSDN recv Function:

... If the connection has been gracefully closed, the return value is zero.

recv(2) - Linux man page:

... The return value will be 0 when the peer has performed an orderly shutdown.