From f7f45e9630912cfca6b3a6b60577f02924c3dbc9 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Jul 2007 00:50:59 +0000 Subject: Ah, that explains much, I did the big reorg -> trunk move and forgot to commit some things, so here they are, after being manually copied. --- src/tests/fstrstd.cpp | 9 +++++++++ src/tests/socketblock.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 src/tests/fstrstd.cpp create mode 100644 src/tests/socketblock.cpp (limited to 'src/tests') diff --git a/src/tests/fstrstd.cpp b/src/tests/fstrstd.cpp new file mode 100644 index 0000000..8dffcb6 --- /dev/null +++ b/src/tests/fstrstd.cpp @@ -0,0 +1,9 @@ +#include +#include "bu/fstring.h" + +int main() +{ + Bu::FString s("Hey there, dude.\n"); + + std::cout << s << 5; +} diff --git a/src/tests/socketblock.cpp b/src/tests/socketblock.cpp new file mode 100644 index 0000000..443b07e --- /dev/null +++ b/src/tests/socketblock.cpp @@ -0,0 +1,50 @@ +#include "bu/ito.h" +#include "bu/socket.h" +#include "bu/serversocket.h" +#include + +class TstServer : public Bu::Ito +{ +public: + TstServer() : + s( 55678 ) + { + } + + virtual void *run() + { + Bu::Socket c = s.accept( 45, 0 ); + printf("TstServer: Accetped connection.\n"); fflush( stdout ); + + sleep( 1 ); + printf("TstServer: Trying to read 10 bytes...\n"); fflush( stdout ); + + char buf[10]; + size_t nRead = c.read( buf, 10 ); + printf("TstServer: Got %d bytes...\n", nRead ); fflush( stdout ); + + printf("TstServer: Closing connection...\n"); fflush( stdout ); + c.close(); + + return NULL; + } + + Bu::ServerSocket s; +}; + +int main() +{ + TstServer ts; + + ts.start(); + + printf("main: Connecting to server.\n"); fflush( stdout ); + Bu::Socket s( "localhost", 55678 ); + + printf("main: Sending 4 bytes.\n"); fflush( stdout ); + s.write( "aoeu", 4 ); + + printf("main: Sleeping 10 seconds for good measure.\n"); fflush( stdout ); + sleep( 10 ); +} + -- cgit v1.2.3