src: removed unused code
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
#include "SocketTest.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
SocketTest::SocketTest(QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_socket(NULL)
|
||||
{
|
||||
m_socket = new QUdpSocket(this);
|
||||
QHostAddress address("127.0.0.1");
|
||||
m_socket->bind(address, 6666);
|
||||
|
||||
connect(m_socket, &QUdpSocket::readyRead, this, &SocketTest::readyRead);
|
||||
}
|
||||
|
||||
SocketTest::~SocketTest()
|
||||
{
|
||||
if(m_socket != NULL)
|
||||
{
|
||||
delete m_socket;
|
||||
}
|
||||
}
|
||||
|
||||
void SocketTest::sendTestMessage()
|
||||
{
|
||||
LOG_WARNING("SocketTest::sendTestMessage");
|
||||
|
||||
QByteArray Data;
|
||||
Data.append("qt foo");
|
||||
|
||||
m_socket->writeDatagram(Data, QHostAddress::Any, 6666);
|
||||
}
|
||||
|
||||
void SocketTest::readyRead()
|
||||
{
|
||||
LOG_WARNING("SocketTest::readyRead");
|
||||
|
||||
QByteArray buffer;
|
||||
buffer.resize(m_socket->pendingDatagramSize());
|
||||
|
||||
QHostAddress sender;
|
||||
quint16 senderPort;
|
||||
|
||||
m_socket->readDatagram(buffer.data(), buffer.size(), &sender, &senderPort);
|
||||
|
||||
std::string message = buffer.data();
|
||||
|
||||
LOG_WARNING(message);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef SOCKET_TEST_H
|
||||
#define SOCKET_TEST_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qudpsocket.h>
|
||||
|
||||
class SocketTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SocketTest(QObject* parent);
|
||||
~SocketTest();
|
||||
|
||||
void sendTestMessage();
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void readyRead();
|
||||
|
||||
private:
|
||||
QUdpSocket* m_socket;
|
||||
};
|
||||
|
||||
#endif // SOCKET_TEST_H
|
||||
Reference in New Issue
Block a user