Boost.ASIO库编译错误,急
我用的是ASIO里chat的例子,服务器端,我想获取每个session的IP地址,然后好对应发送数据。
我把Session里的socket_搞成了public,然后在chat_server类中获取socket_得到以下错误:
e:\boost_1_34_0\boost_1_34_0\boost\asio\basic_io_object.hpp(70) : error C2248: 'boost::noncopyable_::noncopyable::noncopyable' : cannot access private member declared in class 'boost::noncopyable_::noncopyable'
e:\boost_1_34_0\boost_1_34_0\boost\noncopyable.hpp(27) : see declaration of 'boost::noncopyable_::noncopyable::noncopyable'
e:\boost_1_34_0\boost_1_34_0\boost\noncopyable.hpp(22) : see declaration of 'boost::noncopyable_::noncopyable'
This diagnostic occurred in the compiler generated function 'boost::asio::basic_io_object<Service>::basic_io_object(const boost::asio::basic_io_object<Service> &)'
with
[
Service=boost::asio::stream_socket_service<boost::asio::ip::tcp>
]
我的实现方法:
void write( const chat_message& msg , std::vector<std::string> ip2send )
{
int m = m_client_list.size();
int n = ip2send.size();
for ( int i = 0; i < m;i++ )
{
for ( int k = 0; k < n; k++ )
{
tcp::socket sock = m_client_list[i]->socket_;
if ( ip2send[k] == get_ip_address( sock ) )
{
m_client_list[i]->do_write( msg );
}
}
}
}