25 lines
473 B
C++
25 lines
473 B
C++
#include <QUdpSocket>
|
|
#include <QObject>
|
|
#include <iostream>
|
|
|
|
using std::cout;
|
|
using std::endl;
|
|
|
|
class UdpSender : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
QString recstr;
|
|
UdpSender(QString IP, quint16 Port);
|
|
~UdpSender();
|
|
void connectSend(QString s);
|
|
public slots:
|
|
void slotRead();
|
|
private:
|
|
QUdpSocket * sock;
|
|
QHostAddress addr;
|
|
quint16 port;
|
|
quint32 sz;
|
|
QByteArray * senddata;
|
|
};
|