I'm using the recv
function in a loop to receive network data, but let's say I want to stop receiving data mid-loop. I could just break the loop, but this doesn't seem like a very clean way to stop receiving data.
So is there any way to cleanly stop receiving data, or is just breaking the loop ok? It's HTTP GET/POST requests.
Here's simplifed I'm using:
do {
nDataLen = recv(mySocket, data, BUFFSIZE, 0);
if (nDataLen > 0)
{
/* Process Data */
// I'd like to break out of the loop
// if something is found when processing the data
// But, I want to do this cleanly.
}
} while (nDataLen != 0);