QTfrontend/netudpwidget.cpp
changeset 5146 7b65e83e261d
parent 4976 088d40d8aba2
child 5147 a2ae7702bb75
--- a/QTfrontend/netudpwidget.cpp	Thu Apr 14 18:17:30 2011 -0400
+++ b/QTfrontend/netudpwidget.cpp	Fri Apr 15 21:36:59 2011 +0400
@@ -37,6 +37,7 @@
     reset();
 
     pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631);
+    pUdpSocket->writeDatagram("hedgewars client", QHostAddress("127.0.0.1"), 46631);
 }
 
 void HWNetUdpModel::onClientRead()
@@ -49,9 +50,10 @@
 
         pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort);
 
-        if(QString("%1").arg(datagram.data())==QString("hedgewars server")) {
+        QString packet = QString::fromUtf8(datagram.data());
+        if(packet.startsWith("hedgewars server")) {
             QStringList sl;
-            sl << "-" << clientAddr.toString() << "46631";
+            sl << packet.remove(0, 17) << clientAddr.toString() << "46631";
             games.append(sl);
         }
     }