Removed func "sendPing" from class Network and moved to class

ContactManager.
This commit is contained in:
Denis Davydov 2018-05-20 15:16:12 +03:00
parent aaea262861
commit 585c4d9e77

View File

@ -8,13 +8,6 @@ class Network
socket->bind(QHostAddress::AnyIPv6, 6552); socket->bind(QHostAddress::AnyIPv6, 6552);
connect(socket, SIGNAL(readyRead()), SLOT(read())); connect(socket, SIGNAL(readyRead()), SLOT(read()));
} }
void sendPing(QHostAddress ip)
{
json ping;
ping["action"] = "ping";
QString str = ping.dump();
send(str, ip);
}
void send(QString str, QHostAddress ip) void send(QString str, QHostAddress ip)
{ {
QByteArray data; QByteArray data;
@ -25,7 +18,7 @@ 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() void read()
{ {
QByteArray buffer; QByteArray buffer;
buffer.resize(socket->pendingDatagramSize()); buffer.resize(socket->pendingDatagramSize());