|
Boost Users : |
Subject: Re: [Boost-users] error: no matching function for call to âboost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >::basic_stream_socket()â
From: Igor R (boost.lists_at_[hidden])
Date: 2010-02-18 10:41:19
> 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.
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