Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core2/src/network/dummyserver3.cc @ 933

Last change on this file since 933 was 790, checked in by nicolasc, 17 years ago

merged FICN back into trunk
awaiting release.

File size: 843 bytes
Line 
1#include <iostream>
2
3#include "util/Sleep.h"
4#include "PacketManager.h"
5#include "PacketTypes.h"
6#include "Server.h"
7
8namespace network
9{
10
11  class dummyserver3 : public Server
12  {
13  public:
14    dummyserver3();
15    ~dummyserver3();
16    void loop();
17  private:
18    void tick();
19    void processChat( chat *data, int clientId);
20
21
22  };
23
24  dummyserver3::dummyserver3(){
25  }
26  dummyserver3::~dummyserver3(){
27  }
28
29  void dummyserver3::loop(){
30    open();
31    while(true){
32      tick();
33      usleep(100);
34    }
35  }
36
37  void dummyserver3::processChat( chat *data, int clientId){
38    std::cout << "Client " << clientId << " sent: " << data->message << std::endl;
39    sendMSG(data->message);
40  }
41
42  void dummyserver3::tick(){
43    processQueue();
44  }
45
46}
47
48int main(int argc, char **argv[]){
49  network::dummyserver3 server;
50  server.loop();
51  return 0; 
52}
Note: See TracBrowser for help on using the repository browser.