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