18 setWindowTitle(
"UdpServer");
20 m_pudp =
new QUdpSocket(
this);
22 QTimer* ptimer =
new QTimer(
this);
23 ptimer->setInterval(500);
25 connect(ptimer, SIGNAL(timeout()), SLOT(slotSendDatagram()));
29 void UdpServer::slotSendDatagram()
31 QByteArray baDatagram;
32 QDataStream out(&baDatagram, QIODevice::WriteOnly);
33 out.setVersion(QDataStream::Qt_5_3);
34 QDateTime dt = QDateTime::currentDateTime();
35 append(
"Sent:" + dt.toString());
37 m_pudp->writeDatagram(baDatagram, QHostAddress::LocalHost, 2424);
UdpServer(QWidget *pwgt=0)