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.
... If the connection has been gracefully closed, the return value is zero.
... The return value will be 0 when the peer has performed an orderly shutdown.