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