QTfrontend/netudpserver.cpp
changeset 486 7ea71cd3acd5
parent 468 8403d6884707
child 633 9050a949db21
equal deleted inserted replaced
485:defe001d490c 486:7ea71cd3acd5
       
     1 /*
       
     2  * Hedgewars, a worms-like game
       
     3  * Copyright (c) 2007 Ulyanov Igor <iulyanov@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  */
       
    18 
     1 #include <QUdpSocket>
    19 #include <QUdpSocket>
     2 
    20 
     3 #include "netudpserver.h"
    21 #include "netudpserver.h"
     4 
    22 
     5 HWNetUdpServer::HWNetUdpServer(QObject* parent) :
    23 HWNetUdpServer::HWNetUdpServer(QObject* parent) :
     7 {
    25 {
     8   pUdpSocket = new QUdpSocket(this);
    26   pUdpSocket = new QUdpSocket(this);
     9   pUdpSocket->bind(46631);
    27   pUdpSocket->bind(46631);
    10 
    28 
    11   connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead()));
    29   connect(pUdpSocket, SIGNAL(readyRead()), this, SLOT(onClientRead()));
    12   
    30 
    13 }
    31 }
    14 
    32 
    15 void HWNetUdpServer::onClientRead()
    33 void HWNetUdpServer::onClientRead()
    16 {
    34 {
    17   while (pUdpSocket->hasPendingDatagrams()) {
    35   while (pUdpSocket->hasPendingDatagrams()) {