diff options
Diffstat (limited to 'src/test/clistress')
| -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 | |||
