udpclient.h
#ifndef UDPCLIENT_H
#define UDPCLIENT_H
#include <QDialog>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QPushButton>
#include <QUdpSocket>
class UdpClient : public QDialog
{
Q_OBJECT
public:
UdpClient(QWidget *parent = 0, Qt::WindowFlags f = 0);
~UdpClient();
private:
QTextEdit *ReceiveTextEdit;
QPushButton *CloseBtn;
QVBoxLayout *mainLayout;
int port;
QUdpSocket *udpSocket;
private slots:
void CloseBtnClicked();
void dataReceived();
};
#endif // UDPCLIENT_H
udpclient.cpp
#include "udpclient.h"
#include "ui_udpclient.h"
#include <QMessageBox>
#include <QHostAddress>
UdpClient::UdpClient(QWidget *parent, Qt::WindowFlags f) :
QDialog(parent, f)
{
setW