Browse Source

Comply with bio standard

master
h-4nd-h 2 years ago
parent
commit
0ef1a5c04f
  1. 6
      socket.cpp
  2. 1
      socket.h

6
socket.cpp

@ -7,7 +7,7 @@ UdpSocket::UdpSocket(QObject* parent, quint16 port) :
{
_socket = new QUdpSocket(this);
_socket->bind(QHostAddress::LocalHost, port);
connect(_socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
connect(_socket, &QUdpSocket::readyRead, this, &UdpSocket::readyRead);
}
UdpSocket::~UdpSocket()
@ -39,8 +39,8 @@ void UdpSocket::readyRead()
{
QByteArray Buffer;
Buffer.resize(_socket->pendingDatagramSize());
QHostAddress sender_addr{};
quint16 sender_port{};
QHostAddress sender_addr;
quint16 sender_port;
_socket->readDatagram(Buffer.data(), Buffer.size(), &sender_addr, &sender_port);
qDebug() << "New Message arrived at" << getTime();

1
socket.h

@ -16,6 +16,7 @@ private:
public:
explicit UdpSocket(QObject* parent = nullptr, quint16 port = 1234);
~UdpSocket();
void sayHello();
void sayMsg(QString Msg);

Loading…
Cancel
Save