提交 b715d839 编写于 作者: M mlinlmcc 提交者: Gitee

适配不同平台recv实现不同,可能存在单次recv数据不完全的情况

上级 3046b5a6
......@@ -142,7 +142,7 @@ static void SampleTcpServerTask(void)
int recvSum = 0;
int recvTimes = 50;
while (recvTimes > 0) {
ret = recv(clientFd, buf, sizeof(buf), 0);
ret = recv(sfd, buf, sizeof(buf), 0);
recvSum += ret;
if (recvSum == (len * strlen(SRV_MSG)) || ret <= 0) {
break;
......@@ -238,7 +238,7 @@ static void SampleTcpClientTask(void)
int recvSum = 0;
int recvTimes = 50;
while (recvTimes > 0) {
ret = recv(clientFd, buf, sizeof(buf), 0);
ret = recv(sfd, buf, sizeof(buf), 0);
recvSum += ret;
if (recvSum == (len * strlen(SRV_MSG)) || ret <= 0) {
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册