Created
February 16, 2017 11:44
-
-
Save iamazeem/4aac4f9b626f93bd1e3e4b38e1468cfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QObject> | |
#include <QCoreApplication> | |
#include <QUdpSocket> | |
#include <QTimer> | |
int main( int argc, char *argv[] ) | |
{ | |
QCoreApplication app( argc, argv ); | |
QUdpSocket _s; | |
_s.bind( QHostAddress::LocalHost, 9000 ); | |
QTimer t; | |
t.start( 500 ); | |
QObject::connect( &t, &QTimer::timeout, [&_s]() | |
{ | |
const QByteArray str { "Testing...\n" }; | |
auto ret = _s.writeDatagram( str, QHostAddress::LocalHost,9000 ); | |
qDebug() << str << "ret:" << ret; | |
}); | |
return app.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment