4.20 多进程实现并发服务器 要实现TCP通信服务器处理并发的任务,使用多线程或者多进程来解决。 思路: 1、一个父进程,多个子进程 2、父进程负责等待并接受客户端的连接 3、子进程:完成通信,接受一个客户端连接,就创建一个子进程用于通信 server_process.c #include <stdio.h> #include <arpa/inet.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <wait.h> #include <errno.h> void recyleChild(int arg) { while(1) { int ret = waitpid(-1, NULL, WNOHANG); if(ret == -1) { break; }else if(ret == 0) { break; } else if(ret > 0){ printf("子进程 %d 被回收了\n", ret); } } } int main() {...