Exemple #1
0
	void delivery()
	{
		std::vector<char>	buf(BUFF_SIZE);
		while(src_sock.available()){
			src_sock.read_some(boost::asio::buffer(buf));
			dest_sock.write_some(boost::asio::buffer(buf));
		}
		while(dest_sock.available()){
			dest_sock.read_some(boost::asio::buffer(buf));
			src_sock.write_some(boost::asio::buffer(buf));
		}
		return;
	}
Exemple #2
0
void TcpBase::sendQueuedMessages(tcp::socket& s) {
    mutex::scoped_lock lock(mutex_);
    while (!outQueue_.empty()) {
        std::string message = outQueue_.front();
        boost::system::error_code error;
        s.write_some(boost::asio::buffer(message.data(), message.size()), error);
        if (error) {
            throw boost::system::system_error(error);
        }
        logTrace("TX: " + message);
        outQueue_.pop();
    }
}
Exemple #3
0
boost::system::error_code sendRequest(tcp::socket & socket, uint32_t sequence, Words words)
{
	boost::system::error_code error;

	TextRconPacket textRequest(false, false, sequence, words);

	BinaryRconPacket binaryRequest(textRequest);

	const uint8_t* requestData;
	unsigned int requestLength;
	binaryRequest.getBuffer(requestData, requestLength);

	socket.write_some(boost::asio::buffer(reinterpret_cast<const char*>(requestData), requestLength), error);

	return error;	
}