mirror of
https://github.com/ChronosX88/Influence-cjdns.git
synced 2024-11-23 15:42:18 +00:00
Added the function ReadyRead, which accepts datagrams.
This commit is contained in:
parent
d36a361b9a
commit
d20b4188aa
@ -25,4 +25,14 @@ class Network
|
|||||||
out << qint64(data.size() - sizeof(qint64));
|
out << qint64(data.size() - sizeof(qint64));
|
||||||
socket->writeDatagram(data, QHostAddress(ip), 6552);
|
socket->writeDatagram(data, QHostAddress(ip), 6552);
|
||||||
}
|
}
|
||||||
|
void readyRead()
|
||||||
|
{
|
||||||
|
QByteArray buffer;
|
||||||
|
buffer.resize(socket->pendingDatagramSize());
|
||||||
|
QHostAddress sender;
|
||||||
|
socket->readDatagram(buffer.data(), buffer.size(),
|
||||||
|
&sender;, &senderPort;);
|
||||||
|
qDebug() << "Message from: " << sender.toString();
|
||||||
|
qDebug() << "Message: " << buffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user