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.
Note that it is an async. implementation for *synchronous* use, and when you use sync. i/o you do not explicitly run io_service:
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.io_service io;
tcp::socket sock(io);
// open socket, define your buffer..., then:
read_with_timeout(sock, buffer);