Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::asio multiprocess
From: Marco Piacentini (marcopiacenta_at_[hidden])
Date: 2011-03-01 15:25:37


Thank you for your reply,what do you mean with native_type ? is a boost function? I need to make a multi process TCP Server..so I think it is mandatory to me to "parallelize" the server with process...are you sure that is enough to use the asynchronous model? ________________________________ Da: Igor R <boost.lists_at_[hidden]> A: boost-users_at_[hidden] Inviato: Mar 1 marzo 2011, 19:46:27 Oggetto: Re: [Boost-users] boost::asio multiprocess > Hi guys...I would to make a simple multi process (not thread) server. I've > seen the iterative example in which it handles one request at a time. > Instead I need to handle more requests(more on less 10) at the same time. In > the classic c and c++ examples, I've seen that the server is designed like > the following: > > int listensd, connsd; // listening socket and conection socket > pid_t pid; //process id > listensd=socket(....); > bind(listensd,...); > listen(listensd,...); > for(;;) > { > > connsd=accept(listensd,...); > if((pid=fork())==0) //child process > { > close(listensd); //close the listen socket > do_it(connsd); //serve the request > close(connsd); //close the connection socket > exit(0); > } > close(connsd); //the parent closes the connection socket > } > > Is it possible to do something like that with boost? I really don't know how > obtain the two different socket, because in boost all the function (listen, > bind, accept, etc.) return void. ASIO objects wrap native handles, and you can access them using native_type() member function. But if all you need is to process simultanious requests efficiently, you don't need to launch neither threads nor processes. All you need is to stick with ASIO asynchronous model - just like explained in the tutorial/examples. _______________________________________________ Boost-users mailing list Boost-users_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/boost-users



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net