diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-08-25 20:54:47 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-08-25 20:54:47 +0000 |
commit | 0a700ced28520be170c0965191f2450a2e4a82ac (patch) | |
tree | 6858e7178d9ddd30113824da4728729b06d018b5 /src/test/clistress | |
parent | 0c2d075e795858779af102e932a881498e2268ae (diff) | |
download | libbu++-0a700ced28520be170c0965191f2450a2e4a82ac.tar.gz libbu++-0a700ced28520be170c0965191f2450a2e4a82ac.tar.bz2 libbu++-0a700ced28520be170c0965191f2450a2e4a82ac.tar.xz libbu++-0a700ced28520be170c0965191f2450a2e4a82ac.zip |
Added tests and exception codes, so you're program can tell just how bad things
really are.
Diffstat (limited to '')
-rw-r--r-- | src/test/clistress/main.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/test/clistress/main.cpp b/src/test/clistress/main.cpp new file mode 100644 index 0000000..3f5038b --- /dev/null +++ b/src/test/clistress/main.cpp | |||
@@ -0,0 +1,39 @@ | |||
1 | #include "connection.h" | ||
2 | |||
3 | void _waitForLength( Connection &con, int len) | ||
4 | { | ||
5 | int rlen = con.getInputAmnt(); | ||
6 | |||
7 | if (rlen >= len) | ||
8 | return; | ||
9 | |||
10 | int time_left = 5; | ||
11 | int mic_left = 0; | ||
12 | |||
13 | while (rlen < len) | ||
14 | { | ||
15 | if (time_left == 0 && mic_left == 0) | ||
16 | { | ||
17 | throw "Socket Timeout"; | ||
18 | } | ||
19 | con.readInput(time_left, mic_left, &time_left, &mic_left); | ||
20 | rlen = con.getInputAmnt(); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | int main() | ||
25 | { | ||
26 | Connection c; | ||
27 | |||
28 | c.open("localhost", 4001 ); | ||
29 | |||
30 | c.appendOutput("d"); | ||
31 | c.writeOutput(); | ||
32 | |||
33 | _waitForLength( c, 40 ); | ||
34 | |||
35 | c.close(); | ||
36 | |||
37 | return 0; | ||
38 | } | ||
39 | |||