19 Feb
2010
19 Feb
'10
12:44 p.m.
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.