This article is senlie original, reproduced Please retain this address: http://blog.csdn.net/zhengsenlie
1. the iterative TCP Server Always redirects to the next customer only after completely processing the request of a customer.
2. From the process control perspective, the iteration server is the fastest because it does not execute process control.
/* Include serv00 */# include "unp. H "intmain (INT argc, char ** argv) {intlistenfd, connfd; voidsig_int (INT), web_child (INT); socklen_tclilen, addrlen; struct sockaddr * cliaddr; // 1. use tcp_listen to create a TCP socket --> protocol-independent. Both IPv4 and IPv6 are applicable to If (argc = 2) listenfd = tcp_listen (null, argv [1], & addrlen ); else if (argc = 3) listenfd = tcp_listen (argv [1], argv [2], & addrlen); elseerr_quit ("Usage: serv00 [
UNIX Network Programming volume 1 Server programming paradigm 0 iteration Server