Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/network/dummyserver3.cc @ 744

Last change on this file since 744 was 533, checked in by rgrieder, 17 years ago
  • some minor changes in order to make the project compile with VC08 (doesn't yet)
File size: 878 bytes
Line 
1#include <iostream>
2#include "PacketManager.h"
3//#include "PacketTypes.h"
4#include "Server.h"
5
6#ifdef WIN32
7#include <windows.h>
8#define usleep(x) Sleep((x)/1000)
9#else
10#include <unistd.h>
11#endif
12
13namespace network{
14 
15class dummyserver3 : public Server{
16  public:
17  dummyserver3();
18  ~dummyserver3();
19  void loop();
20  private:
21  void tick();
22  void processChat( chat *data, int clientId);
23 
24 
25 
26};
27
28dummyserver3::dummyserver3(){
29}
30dummyserver3::~dummyserver3(){
31}
32
33void dummyserver3::loop(){
34  open();
35  while(true){
36    tick();
37    usleep(100);
38  }
39}
40
41void dummyserver3::processChat( chat *data, int clientId){
42  std::cout << "Client " << clientId << " sent: " << data->message << std::endl;
43  sendMSG(data->message);
44}
45
46void dummyserver3::tick(){
47  processQueue();
48}
49
50
51}
52
53int main(int argc, char **argv[]){
54  network::dummyserver3 server;
55  server.loop();
56  return 0; 
57}
Note: See TracBrowser for help on using the repository browser.