Re: [asio-users] multiple ports on same io_service, attaching other services
Brought to you by:
chris_kohlhoff
From: Richard D. <rdi...@gm...> - 2006-11-30 08:45:23
|
You seem to have the wrong idea about the io_service - it exists only to "run" sockets (lots of them), and does not represent any port or socket itself. In the example, the easiest way to listen on two ports is simply to create two servers: server s1(io_service, atoi(argv[1])); server s2(io_service, atoi(argv[1]) + 1); Richard On 11/30/06, Charlls Quarra <cha...@ya...> wrote: > > > Hi, > > I have two, likely unrelated, questions. > > it is possible to handle multiple ports on the same > io_service? the common way would be to have a > io_service for each port, but this demands a thread > per port, so i was investigating a way to handle > various connections on the same io_service, in > particular having more than one tcp::acceptor calling > async_accept. In my simple-minded attempt to do this ( > i attach the source of the example involved, is just > async_tcp_echo_server slightly modified ). The example > uses two acceptors (acceptor_A and acceptor_B). I > found that when a second client connects after a first > client has connected on the other port, the server > locks up and it stop being responsive. > What went wrong? or isn't supposed to handle multiple > ports per io_service? > > the second question is about the > io_service::add/has_service calls; i was curious about > how these fit in the whole machine and i wondered in > what practical circumstances one may need to use > these? > > > > __________________________________________________ > Correo Yahoo! > Espacio para todos tus mensajes, antivirus y antispam =A1gratis! > =A1Abr=ED tu cuenta ya! - http://correo.yahoo.com.ar > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share y= our > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > > _______________________________________________ > asio-users mailing list > asi...@li... > https://lists.sourceforge.net/lists/listinfo/asio-users > > > > |