Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 1:10:46 AM (16 years ago)
Author:
rgrieder
Message:

SVN doesn't seem to like me. Reverted some really badly converted line endings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/dummyserver.cc

    r1494 r1495  
    1 /* *   ORXONOX - the hottest 3D action shooter ever to exist *                    > www.orxonox.net < * * *   License notice: * *   This program is free software; you can redistribute it and/or *   modify it under the terms of the GNU General Public License *   as published by the Free Software Foundation; either version 2 *   of the License, or (at your option) any later version. * *   This program is distributed in the hope that it will be useful, *   but WITHOUT ANY WARRANTY; without even the implied warranty of *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *   GNU General Public License for more details. * *   You should have received a copy of the GNU General Public License *   along with this program; if not, write to the Free Software *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. * *   Author: *      Oliver Scheuss, (C) 2007 *   Co-authors: *      ... * *///// Dummy server to test ConnectionManager and PacketBuffer classes//// Author: Oliver Scheuss#include <iostream>#include <enet/enet.h>#include "util/Sleep.h"#include "ConnectionManager.h"#include "PacketManager.h"#include "PacketTypes.h"
    2 #include "ClientInformation.h"using namespace network;int main(){  bool quit=false;  ENetPacket *packet;  ClientInformation clients;  ConnectionManager server = ConnectionManager(&clients);  server.createListener();  PacketDecoder dec;  while(!quit){    if(server.queueEmpty())      // Warning: usleep(100) is Sleep(100/1000) = Sleep(0), which is nothing!      usleep(1);    else{      ENetAddress addr;      packet=server.getPacket(addr);      if(packet==NULL){        // there was some error        //std::cout << "null pointer" << std::endl;        quit=true;      }      else{        //std::cout << "We received: " << packet->data << std::endl;        dec.elaborate(packet, 1);      }    }  }  server.quitListener();  return 0;}
     1/*
     2 *   ORXONOX - the hottest 3D action shooter ever to exist
     3 *                    > www.orxonox.net <
     4 *
     5 *
     6 *   License notice:
     7 *
     8 *   This program is free software; you can redistribute it and/or
     9 *   modify it under the terms of the GNU General Public License
     10 *   as published by the Free Software Foundation; either version 2
     11 *   of the License, or (at your option) any later version.
     12 *
     13 *   This program is distributed in the hope that it will be useful,
     14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 *   GNU General Public License for more details.
     17 *
     18 *   You should have received a copy of the GNU General Public License
     19 *   along with this program; if not, write to the Free Software
     20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     21 *
     22 *   Author:
     23 *      Oliver Scheuss, (C) 2007
     24 *   Co-authors:
     25 *      ...
     26 *
     27 */
     28
     29//
     30// Dummy server to test ConnectionManager and PacketBuffer classes
     31//
     32// Author: Oliver Scheuss
     33
     34#include <iostream>
     35#include <enet/enet.h>
     36
     37#include "util/Sleep.h"
     38#include "ConnectionManager.h"
     39#include "PacketManager.h"
     40#include "PacketTypes.h"
     41#include "ClientInformation.h"
     42
     43using namespace network;
     44
     45int main(){
     46  bool quit=false;
     47  ENetPacket *packet;
     48  ClientInformation clients;
     49  ConnectionManager server = ConnectionManager(&clients);
     50  server.createListener();
     51
     52  PacketDecoder dec;
     53
     54  while(!quit){
     55    if(server.queueEmpty())
     56      // Warning: usleep(100) is Sleep(100/1000) = Sleep(0), which is nothing!
     57      usleep(1);
     58    else{
     59      ENetAddress addr;
     60      packet=server.getPacket(addr);
     61      if(packet==NULL){
     62        // there was some error
     63        //std::cout << "null pointer" << std::endl;
     64        quit=true;
     65      }
     66      else{
     67        //std::cout << "We received: " << packet->data << std::endl;
     68        dec.elaborate(packet, 1);
     69      }
     70    }
     71  }
     72  server.quitListener();
     73  return 0;
     74}
Note: See TracChangeset for help on using the changeset viewer.