From 0a700ced28520be170c0965191f2450a2e4a82ac Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 25 Aug 2006 20:54:47 +0000 Subject: Added tests and exception codes, so you're program can tell just how bad things really are. --- src/test/clistress/main.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/test/clistress/main.cpp (limited to 'src/test/clistress') 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 @@ +#include "connection.h" + +void _waitForLength( Connection &con, int len) +{ + int rlen = con.getInputAmnt(); + + if (rlen >= len) + return; + + int time_left = 5; + int mic_left = 0; + + while (rlen < len) + { + if (time_left == 0 && mic_left == 0) + { + throw "Socket Timeout"; + } + con.readInput(time_left, mic_left, &time_left, &mic_left); + rlen = con.getInputAmnt(); + } +} + +int main() +{ + Connection c; + + c.open("localhost", 4001 ); + + c.appendOutput("d"); + c.writeOutput(); + + _waitForLength( c, 40 ); + + c.close(); + + return 0; +} + -- cgit v1.2.3