Boost logo

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: David Kaplan (davkaplan_at_[hidden])
Date: 2010-02-18 10:49:35


>> 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.

I tied _socket(ioService), still no luck....

>> 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.

Thanks - will try this out.


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