18 Feb
2010
18 Feb
'10
3:41 p.m.
Why doesn't this work:
_socket = tcp::socket(ioService);
1) Socket has no default constructor. You have to pass ioService to its constructor. 2) socket it not copiable/assignable.
Also, is there any way to define a timeout on a synchronous connect()?
No.
If not, what's the workaround?
You can write your own sync. connect with timeout, using async_connect, like this: http://lists.boost.org/Archives/boost/2007/04/120339.php
Can I do an async connect and then somehow return to synchronous mode of operation?
Sure, you can mix sync and async approaches.