sAudioReceiver(boost::asio::io_service& io_service, sAudioBuffer* audiobuf, char* host, int port) : audiobuf(audiobuf), socket(io_service), ping_interval(boost::posix_time::seconds(1)) { printf("Creating sAudioReceiver on %s:%d\n", host, port); socket.open(boost::asio::ip::udp::v4()); receiver_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(host), port); std::string thx("ihazo"); std::copy(thx.begin(), thx.end(), send_arr.begin()); printf("Created sAudioReceiver\n"); send_request(); start_receive(); printf("Sent request\n"); ping_timer = new boost::asio::deadline_timer(socket.get_io_service(), ping_interval); start_timer(); }
boost::asio::io_service &get_io_service() { return socket.get_io_service(); }