From 8302fafa9621050a5c4ee54f19887219419989f4 Mon Sep 17 00:00:00 2001 From: yzc Date: Thu, 2 Jan 2020 13:17:27 +0800 Subject: [PATCH] =?UTF-8?q?socket=E5=BE=AA=E7=8E=AF=E6=8E=A5=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- http_check/src/http_check.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/http_check/src/http_check.c b/http_check/src/http_check.c index 7732eaf..e80ab56 100644 --- a/http_check/src/http_check.c +++ b/http_check/src/http_check.c @@ -161,7 +161,7 @@ int readNlSock(int sockFd, char *bufPtr, int seqNum, int pId) { struct nlmsghdr *nlHdr = NULL; int readLen = 0, msgLen = 0; - do{ + while(1){ //收到内核的应答 if((readLen = recv(sockFd, bufPtr, BUFSIZE - msgLen, 0)) < 0) { @@ -192,12 +192,11 @@ int readNlSock(int sockFd, char *bufPtr, int seqNum, int pId) bufPtr += readLen; msgLen += readLen; } - if((nlHdr->nlmsg_flags & NLM_F_MULTI) == 0) { break; } - } while((nlHdr->nlmsg_seq != seqNum) || (nlHdr->nlmsg_pid != pId)); + } return msgLen; }