dev send msg part

This commit is contained in:
zzy 2023-11-02 23:21:03 +08:00
parent 98794eb508
commit 32a4a51964
3 changed files with 8 additions and 5 deletions

View File

@ -47,6 +47,9 @@ int main(int argc, char** argv)
if(getchar());
exit(-1);
}
if (Buf[strlen(Buf) - 1] == '\n') {
Buf[strlen(Buf) - 1] = '\0';
}
res = send(cfd, Buf, strlen(Buf) + 1, 0);
if (res == -1) {
printf("send error %s", Buf);

View File

@ -75,8 +75,8 @@ int main(int argc, char** argv)
exit(-1);
}
szlocal_buf = strlen(local_buf);
if (local_buf[szlocal_buf] == '\n') {
local_buf[szlocal_buf] = '\0';
if (local_buf[szlocal_buf-1] == '\n') {
local_buf[szlocal_buf-1] = '\0';
}
else {
szlocal_buf += 1;
@ -91,7 +91,7 @@ int main(int argc, char** argv)
}
log_head_info_ex(buf, BUFFER_SIZE, "send", g_mask);
tprintf(&std_mutex, buf);
tprintf(&std_mutex, "[Buf]=%d,%s", szlocal_buf, local_buf);
tprintf(&std_mutex, "[send]=%d,\"%s\"\n", szlocal_buf, local_buf);
}
return 0;
}

View File

@ -88,7 +88,7 @@ int main()
int res = make_server_sock(&sfd, _SOCKET_TEST_IP6, _SOCKET_TEST_PORT);
if(res != 0) {
printf("server start error\npress enter to continue");
getchar();
if(getchar());
return 0;
}
printf("server start...\n");
@ -98,7 +98,7 @@ int main()
printf("%s", Buf);
if(strncasecmp(Buf, "exit", strlen("exit")) == 0) {
printf("exit success\npress enter to continue");
getchar();
if(getchar());
exit(-1);
}
}