UNIX Network Programming Volume 1 server Programming paradigm 6 Concurrent servers, creating one thread for each client request

Source: Internet
Author: User
Tags sigint signal

This article is Senlie original, reprint please retain this address:Http://blog.csdn.net/zhengsenlie


1. Create a thread for each customer request in lieu of deriving a child process for each customer



/* include serv06 */#include "unpthread.h" intmain (int argc, char **argv) {INTLISTENFD, Connfd;voidsig_int (int); Void*doit (void *);p Thread_ttid;socklen_tclilen, Addrlen;struct sockaddr*cliaddr;//1. Create a listener socket 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:serv06 [


UNIX Network Programming Volume 1 server Programming paradigm 6 Concurrent servers, creating one thread for each client request

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.