Example UDP server project
This commit is contained in:
22
simulation/VirtualLedBoard/udpserver.h
Normal file
22
simulation/VirtualLedBoard/udpserver.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#ifndef UDPSERVER_H
|
||||
#define UDPSERVER_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QUdpSocket>
|
||||
|
||||
class UdpServer : public QAbstractItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UdpServer(QObject *parent = nullptr);
|
||||
|
||||
|
||||
private:
|
||||
void initSocket();
|
||||
void readPendingDatagrams();
|
||||
QUdpSocket *mUdpSocket;
|
||||
void processTheDatagram(QNetworkDatagram datagram);
|
||||
};
|
||||
|
||||
#endif // UDPSERVER_H
|
||||
Reference in New Issue
Block a user