static void logical_cli(FILE* stream, int sockfd) { char sendline[128]; char recvline[128]; while (fgets(sendline, sizeof(sendline), stream) != NULL) { common_writen(sockfd, sendline, strlen(sendline)); if (common_readline(sockfd, sizeof(recvline), recvline) == 0) return; fprintf(stdout, "%s", recvline); } }
static DWORD WINAPI echo_process(void* arg) { int fd = *(int*)arg; ssize_t n; char buff[1024]; while ((n = common_read(fd, sizeof(buff), buff)) > 0) common_writen(fd, buff, n); common_close(fd); return 0; }