Minor optimisation to the tcp_server code

This is minor optimisation to the tcp_server code:

Note that two lines, one is 'recv(%d) msg from client', the other is 'send mes error',
the second 'mes' should be 'msg', for short. The code is more readable.
This commit is contained in:
David Lin
2020-02-14 22:23:26 +08:00
committed by GitHub
parent 59e403891a
commit 25ad91e04f

View File

@@ -51,7 +51,7 @@ void application_entry(void *arg)
buff[n] = '\0';
printf("recv(%d) msg from client:%s\n", ++cnt, buff);
if ((send(connfd, buff, strlen(buff), 0)) < 0) {
printf("send mes error: %s errno : %d\n", strerror(errno), errno);
printf("send msg error: %s errno : %d\n", strerror(errno), errno);
break;
}
close(connfd);