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: Igor R (boost.lists_at_[hidden])
Date: 2010-02-19 07:44:46


>> Note that if you need to delay the creation of the socket, you might
>> consider using a smart pointer to a socket.
>
> This should solve the issue - thanks! Will try it out...

Besides, you can define io_service as a member of you class, and pass
it to asio objects:

class my_class
{
  my_class() : sock_(io_)
  {}
private:
  // io_ must be declared *before* any other asio objects, which are
going to be initialized with it!
  io_service io_;
  tcp::socket sock_;
};

Note, however, that both io_ and sock_ are non-copyable.


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