我recv
在循环中使用该函数来接收网络数据,但是假设我想在循环中停止接收数据。我可以打破循环,但这似乎不是一种非常干净的方法来停止接收数据。
那么有什么方法可以干净地停止接收数据,或者只是打破循环好吗?这是 HTTP GET/POST 请求。
这是我正在使用的简化版:
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);