Skip to content

Instantly share code, notes, and snippets.

@shimomura1004
Created April 12, 2017 12:29
Show Gist options
  • Save shimomura1004/c8800361b26593dfa8fb794158e535ae to your computer and use it in GitHub Desktop.
Save shimomura1004/c8800361b26593dfa8fb794158e535ae to your computer and use it in GitHub Desktop.
fluentd sender sample with Qt
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QDebug>
#include <qmsgpack/msgpack.h>
#include <QTcpSocket>
int main(int argc, char *argv[])
{
QVariantMap log;
log.insert("status", "error");
QVariantList list;
list << "hoge.debug" << 12345 << log;
QByteArray array = MsgPack::pack(list);
qDebug() << array;
QTcpSocket socket;
socket.connectToHost("localhost", 24224);
socket.waitForConnected(10000);
socket.write(array);
socket.waitForBytesWritten(10000);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment