QTfrontend/netudpwidget.cpp
changeset 416 595d8663254d
parent 414 52e6be3a0985
child 417 bc7fea9abd9c
equal deleted inserted replaced
415:d6d3a6a473a3 416:595d8663254d
    10 {
    10 {
    11   serversList = new QListWidget(this);
    11   serversList = new QListWidget(this);
    12   mainLayout.addWidget(serversList);
    12   mainLayout.addWidget(serversList);
    13   pUdpSocket = new QUdpSocket(this);
    13   pUdpSocket = new QUdpSocket(this);
    14 
    14 
    15   pUdpSocket->bind(46632);
    15   pUdpSocket->bind(46632, QUdpSocket::ShareAddress);
    16   connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead()));
    16   connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead()));
       
    17   updateList();
       
    18 }
       
    19 
       
    20 void HWNetUdpWidget::updateList()
       
    21 {
       
    22   serversList->clear();
    17   pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631);
    23   pUdpSocket->writeDatagram("hedgewars client", QHostAddress::Broadcast, 46631);
    18 }
    24 }
    19 
    25 
    20 void HWNetUdpWidget::onClientRead()
    26 void HWNetUdpWidget::onClientRead()
    21 {
    27 {