this is my server code i want to receive more than 1000000 bytes ,so the data should be splited into many packets so i use loop to receive all data ,if i use like this server always wait for client even client sent all data to server ,my messsage is terminated with "!",so i want to receive untill "!",
do
{
iByteCount = recv(GetSocketId(), buffer,MAXRECV,0);
if ( iByteCount > 0 )
{
printf("Bytes received: %d\n",iByteCount);
strcat(buf,buffer);
}
else if ( iByteCount == 0 )
{
if(strlen(buf)>0)
{
//do process with received data
}
else
printf("receive failed");
break;
}
else
printf("recv failed: ");
break;
} while(iByteCount > 0);}