Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/audio/src/network/dummyserver.cc @ 318

Last change on this file since 318 was 285, checked in by nicolasc, 17 years ago

cleaned up network, builds with CML

File size: 842 bytes
Line 
1//
2// Dummy server to test ConnectionManager and PacketBuffer classes
3//
4// Author: Oliver Scheuss
5
6
7#include <iostream>
8#include "enet/enet.h"
9#include "ConnectionManager.h"
10#include "PacketManager.h"
11
12using namespace network;
13
14int main(){
15  ConnectionManager server = ConnectionManager();
16  bool quit=false;
17  ENetPacket *packet;
18  ENetEvent event;
19  server.createListener();
20
21  PacketDecoder dec;
22
23  while(!quit){
24    if(server.queueEmpty())
25      usleep(100);
26    else{
27      ENetAddress addr;
28      packet=server.getPacket(addr);
29      if(packet==NULL){
30        // there was some error
31        //std::cout << "null pointer" << std::endl;
32        quit=true;
33      }
34      else{
35        //std::cout << "We received: " << packet->data << std::endl;
36        dec.elaborate(packet, 1);
37      }
38    }
39  }
40  server.quitListener();
41  return 0;
42}
Note: See TracBrowser for help on using the repository browser.