Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 632 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
RevLine 
[440]1#include <iostream>
[475]2#include "PacketManager.h"
3//#include "PacketTypes.h"
[440]4#include "Server.h"
5
[533]6#ifdef WIN32
7#include <windows.h>
8#define usleep(x) Sleep((x)/1000)
9#else
10#include <unistd.h>
11#endif
12
[440]13namespace network{
14 
[477]15class dummyserver3 : public Server{
[440]16  public:
17  dummyserver3();
18  ~dummyserver3();
19  void loop();
20  private:
21  void tick();
[477]22  void processChat( chat *data, int clientId);
[440]23 
24 
25 
26};
27
28dummyserver3::dummyserver3(){
29}
30dummyserver3::~dummyserver3(){
31}
32
33void dummyserver3::loop(){
34  open();
[444]35  while(true){
[440]36    tick();
[475]37    usleep(100);
[444]38  }
[440]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(){
[446]47  processQueue();
[440]48}
49
[441]50
[440]51}
52
[441]53int main(int argc, char **argv[]){
54  network::dummyserver3 server;
55  server.loop();
56  return 0; 
[440]57}
Note: See TracBrowser for help on using the repository browser.