0

Could someone explain when is recv() method returning 0? Of course buffer longer than 0 bytes is provided. Method is blocking, so it should wait until it recieves something or throw an error and return -1. I have flag - 0 set. It is not indicating non-blocking mode.

zlenyk
  • 922
  • 2
  • 7
  • 22

1 Answers1

1

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.

Arno
  • 4,994
  • 3
  • 39
  • 63