diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-03-30 22:33:41 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-30 22:33:41 +0000 |
commit | 4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch) | |
tree | 79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/serverticks.cpp | |
parent | c7636dc954eddfe58f7959392602fbc9072d77e7 (diff) | |
download | libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2 libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip |
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to '')
-rw-r--r-- | src/tests/serverticks.cpp | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/src/tests/serverticks.cpp b/src/tests/serverticks.cpp deleted file mode 100644 index 3872a16..0000000 --- a/src/tests/serverticks.cpp +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #include "bu/server.h" | ||
9 | #include "bu/client.h" | ||
10 | #include "bu/protocol.h" | ||
11 | #include <unistd.h> | ||
12 | |||
13 | class TickProtocol : public Bu::Protocol | ||
14 | { | ||
15 | public: | ||
16 | TickProtocol() | ||
17 | { | ||
18 | } | ||
19 | |||
20 | virtual ~TickProtocol() | ||
21 | { | ||
22 | } | ||
23 | |||
24 | virtual void onTick( Bu::Client *pClient ) | ||
25 | { | ||
26 | printf("tick!\n"); | ||
27 | pClient->write("tick!\n"); | ||
28 | } | ||
29 | }; | ||
30 | |||
31 | class TickServer : public Bu::Server | ||
32 | { | ||
33 | public: | ||
34 | TickServer() | ||
35 | { | ||
36 | } | ||
37 | |||
38 | virtual ~TickServer() | ||
39 | { | ||
40 | } | ||
41 | |||
42 | virtual void onNewConnection( Bu::Client *pClient, int ) | ||
43 | { | ||
44 | pClient->setProtocol( new TickProtocol() ); | ||
45 | } | ||
46 | |||
47 | virtual void onClosedConnection( Bu::Client *pClient ) | ||
48 | { | ||
49 | delete pClient->getProtocol(); | ||
50 | } | ||
51 | }; | ||
52 | |||
53 | int main( int , char *[] ) | ||
54 | { | ||
55 | TickServer ts; | ||
56 | |||
57 | ts.setTimeout( 1, 0 ); | ||
58 | ts.setAutoTick(); | ||
59 | ts.addPort( 5555 ); | ||
60 | |||
61 | for(;;) | ||
62 | { | ||
63 | ts.scan(); | ||
64 | sleep( 1 ); | ||
65 | } | ||
66 | |||
67 | return 0; | ||
68 | } | ||
69 | |||