Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost-users][asio] timeout - isio_service.reset() safe with pool of threads?
From: tomasz jankowski (tomasz_jacek_at_[hidden])
Date: 2009-02-02 03:26:57


Dnia 31-01-2009 o godz. 16:46 Igor R napisał(a):

That function assumes the io_service associated with your socket is *stopped*, so it cannot run either in one thread or in multiple threads.

if assumes that io_service is stopped I don't udertand how to implement http://lists.boost.org/Archives/boost/2007/04/120339.php recipe...

You know, io_service must be run for accepting.

don't we have to do it in such way?

  acceptor_(io_service_)
  acceptor_.bind
  acceptor_.listen
  acceptor_.async_accept
  io_service_.run

Note that it is an async. implementation for *synchronous* use, and when you use sync. i/o you do not explicitly run io_service:

I don't understend. what is synchronous here? could You explain Igor?

io_service io;
tcp::socket sock(io);
// open socket, define your buffer..., then:
read_with_timeout(sock, buffer);
 
But if you've already got an async. design, you don't need workarounds to implement timeouts - just use deadline_timer in the straightforward way.



it's mean - how? which example shows it?

Sorry Igor but I'm geneticist. So even after reading asio docs I have still problem with understanding this...

thanks for your answers,

tom



----------------------------------------------------
Nużą Cię utarte scenariusze?
Wymyśl własną grę flashową i wygraj główną nagrodę 5.000 Euro:
http://klik.wp.pl/?adr=http://whosegame.pl/contestcard.php?contest=55&sid=631

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