From 745875139b5ee46e469927d410364bfeeedb2995 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 11 Oct 2006 15:47:45 +0000 Subject: Despite some svn oddness, I'm now moving to a new setup for the tests, that's very much like the original one, but now using build. You will need the latest build in order to build the tests. --- src/tests/connect/main.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/tests/connect/main.cpp (limited to 'src/tests/connect') diff --git a/src/tests/connect/main.cpp b/src/tests/connect/main.cpp new file mode 100644 index 0000000..a9fca64 --- /dev/null +++ b/src/tests/connect/main.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include "connection.h" + +int main() +{ + Connection c; + c.open("127.0.0.1", 12457 ); + + { + int newSocket = c.getSocket(); + int flags; + + flags = fcntl(newSocket, F_GETFL, 0); + flags |= O_NONBLOCK; + if (fcntl(newSocket, F_SETFL, flags) < 0) + { + return false; + } + } + + for( int i = 0; i < 50; i++ ) + { + usleep( 100000 ); + int nbytes = c.readInput(); + if( nbytes == 0 ) + printf("0 bytes, EOF?\n"); + else + printf("Got %d bytes, whacky...\n", nbytes ); + } + + c.close(); + + return 0; +} + -- cgit v1.2.3