void handle_receive(const boost::system::error_code& error, size_t received_bytes) { this->sendto(buf,received_bytes); lsock.async_receive( boost::asio::buffer(buf,MAX_BUF), boost::bind(&interfaces::handle_receive, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); }
interfaces() { memset(data,0,MAX_LINKS*sizeof(struct info)); memset(buf,0,MAX_BUF); lsock.open(boost::asio::ip::udp::v4()); lsock.bind(boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string("127.0.0.1"),10000)); lsock.async_receive( boost::asio::buffer(buf,MAX_BUF), boost::bind(&interfaces::handle_receive, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); boost::thread t = boost::thread (boost::bind(&boost::asio::io_service::run, &iol)); }