1、使用多進程,實現多個客戶端同時下載文件
目錄: 

頭文件
#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <sys/uio.h>#include <sys/socket.h>#include <string.h>#include <sys/epoll.h>#include <netinet/in.h>#include <arpa/inet.h>#define FILENAME "file"typedef struct childdata{ pid_t pid; int fdw; short busy;//標示子進程是否忙碌}cdata,*pcdata;typedef struct tdata{ int len; char buf[1000];}td,*ptd;void make_child(pcdata,int);void set_init(int,char*,char*);void send_file(int);服務器端:
客服端: 
進程數 
新聞熱點
疑難解答