Hello,
This topic has been discussed multiple times but I'm still not understanding something about it.
So I'm receiving data from a source in different chunks and the buffer
I have deals with that nicely but then when all data is received it just
hangs.
My understanding was that recv returns with a -1 when there is no more
data to be read? Can someone help me out?
Thanks.
Code:int leng = 1024;
while(leng!=0)
{
leng = recv(sockfd, buf, 1024-1, 0);
if(leng == 0 || leng == WSAECONNRESET)
{
MessageBox(NULL,"Connection was closed~Exiting",NULL,0);
exit(0);
}
if (leng < 0)
break;
//Output Here
}
