equal
deleted
inserted
replaced
30 connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead())); |
30 connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead())); |
31 } |
31 } |
32 |
32 |
33 void HWNetUdpWidget::updateList() |
33 void HWNetUdpWidget::updateList() |
34 { |
34 { |
35 serversList->clear(); |
35 // serversList->clear(); |
36 pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631); |
36 pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631); |
37 } |
37 } |
38 |
38 |
39 void HWNetUdpWidget::onClientRead() |
39 void HWNetUdpWidget::onClientRead() |
40 { |
40 { |
43 datagram.resize(pUdpSocket->pendingDatagramSize()); |
43 datagram.resize(pUdpSocket->pendingDatagramSize()); |
44 QHostAddress clientAddr; |
44 QHostAddress clientAddr; |
45 quint16 clientPort; |
45 quint16 clientPort; |
46 pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort); |
46 pUdpSocket->readDatagram(datagram.data(), datagram.size(), &clientAddr, &clientPort); |
47 if(QString("%1").arg(datagram.data())==QString("hedgewars server")) { |
47 if(QString("%1").arg(datagram.data())==QString("hedgewars server")) { |
48 serversList->addItem(clientAddr.toString()); |
48 // serversList->addItem(clientAddr.toString()); |
49 } |
49 } |
50 } |
50 } |
51 } |
51 } |