--- a/QTfrontend/netudpserver.cpp Thu Apr 14 18:17:30 2011 -0400
+++ b/QTfrontend/netudpserver.cpp Fri Apr 15 21:36:59 2011 +0400
@@ -22,7 +22,8 @@
#include "netudpserver.h"
HWNetUdpServer::HWNetUdpServer(QObject *parent, const QString & descr, quint16 port) :
- HWNetRegisterServer(parent, descr, port)
+ HWNetRegisterServer(parent, descr, port),
+ m_descr(descr)
{
pUdpSocket = new QUdpSocket(this);
pUdpSocket->bind(46631);
@@ -37,9 +38,9 @@
QHostAddress clientAddr;
quint16 clientPort;
pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort);
- if(QString("%1").arg(datagram.data())==QString("hedgewars client")) {
+ if(datagram.startsWith("hedgewars client")) {
// send answer to client
- pUdpSocket->writeDatagram("hedgewars server", clientAddr, clientPort);
+ pUdpSocket->writeDatagram(QString("hedgewars server\n%1").arg(m_descr).toUtf8(), clientAddr, clientPort);
}
}
}