|
@ -15,6 +15,7 @@ UdpSocket::UdpSocket(QObject* parent, quint16 port) : |
|
|
UdpSocket::~UdpSocket() |
|
|
UdpSocket::~UdpSocket() |
|
|
{ |
|
|
{ |
|
|
qInfo() << "Udp socket deleted!" << "\n"; |
|
|
qInfo() << "Udp socket deleted!" << "\n"; |
|
|
|
|
|
_socket->close(); |
|
|
delete _socket; |
|
|
delete _socket; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -34,6 +35,8 @@ void UdpSocket::sayMsg(const QString& msg) |
|
|
|
|
|
|
|
|
/*******************************************************************************************/ |
|
|
/*******************************************************************************************/ |
|
|
void UdpSocket::readyRead() |
|
|
void UdpSocket::readyRead() |
|
|
|
|
|
{ |
|
|
|
|
|
while(_socket->hasPendingDatagrams()) |
|
|
{ |
|
|
{ |
|
|
QByteArray buffer; |
|
|
QByteArray buffer; |
|
|
buffer.resize(_socket->pendingDatagramSize()); |
|
|
buffer.resize(_socket->pendingDatagramSize()); |
|
@ -42,3 +45,4 @@ void UdpSocket::readyRead() |
|
|
_socket->readDatagram(buffer.data(), buffer.size(), &sender_addr, &sender_port); |
|
|
_socket->readDatagram(buffer.data(), buffer.size(), &sender_addr, &sender_port); |
|
|
Logger::logReceivedData(buffer, sender_addr, sender_port); |
|
|
Logger::logReceivedData(buffer, sender_addr, sender_port); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|