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/itoserver.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/itoserver.cpp | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/tests/itoserver.cpp b/src/tests/itoserver.cpp deleted file mode 100644 index 48ef527..0000000 --- a/src/tests/itoserver.cpp +++ /dev/null | |||
@@ -1,80 +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/itoserver.h" | ||
9 | #include "bu/protocol.h" | ||
10 | #include "bu/client.h" | ||
11 | |||
12 | #define BU_TRACE | ||
13 | #include "bu/trace.h" | ||
14 | |||
15 | class ProtocolEcho : public Bu::Protocol | ||
16 | { | ||
17 | public: | ||
18 | ProtocolEcho() | ||
19 | { | ||
20 | TRACE(); | ||
21 | } | ||
22 | virtual ~ProtocolEcho() | ||
23 | { | ||
24 | TRACE(); | ||
25 | } | ||
26 | |||
27 | virtual void onNewConnection( Bu::Client * ) | ||
28 | { | ||
29 | TRACE(); | ||
30 | // Huh... | ||
31 | } | ||
32 | |||
33 | virtual void onNewData( Bu::Client *pClient ) | ||
34 | { | ||
35 | TRACE(); | ||
36 | char buf[1024]; | ||
37 | while( pClient->hasInput() ) | ||
38 | { | ||
39 | int iAmnt = pClient->read( buf, 1024 ); | ||
40 | pClient->write( buf, iAmnt ); | ||
41 | } | ||
42 | } | ||
43 | }; | ||
44 | |||
45 | class TestServer : public Bu::ItoServer | ||
46 | { | ||
47 | public: | ||
48 | TestServer() | ||
49 | { | ||
50 | TRACE(); | ||
51 | } | ||
52 | virtual ~TestServer() | ||
53 | { | ||
54 | TRACE(); | ||
55 | } | ||
56 | |||
57 | virtual void onNewConnection( Bu::Client *pClient, int ) | ||
58 | { | ||
59 | TRACE(); | ||
60 | pClient->setProtocol( new ProtocolEcho() ); | ||
61 | } | ||
62 | |||
63 | virtual void onClosedConnection( Bu::Client *pClient ) | ||
64 | { | ||
65 | TRACE(); | ||
66 | delete pClient->getProtocol(); | ||
67 | } | ||
68 | }; | ||
69 | |||
70 | int main() | ||
71 | { | ||
72 | TRACE(); | ||
73 | |||
74 | TestServer ts; | ||
75 | |||
76 | ts.addPort( 5555 ); | ||
77 | ts.start(); | ||
78 | ts.join(); | ||
79 | } | ||
80 | |||