diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-03-30 22:33:41 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-30 22:33:41 +0000 |
commit | 4b9289cfb260f4bcecaf23a810584ef6ef8e8501 (patch) | |
tree | 79136af08c7e42ba3322f0d73e9779e4354b318a /src/tests/socketblock.cpp | |
parent | c7636dc954eddfe58f7959392602fbc9072d77e7 (diff) | |
download | libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.gz libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.bz2 libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.tar.xz libbu++-4b9289cfb260f4bcecaf23a810584ef6ef8e8501.zip |
Ok, string stuff is working much, much better, a load of new unit tests have
been added, and I deleted a whole slew of stupid old tests that I don't need.
Diffstat (limited to '')
-rw-r--r-- | src/tests/socketblock.cpp | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/tests/socketblock.cpp b/src/tests/socketblock.cpp deleted file mode 100644 index e36bb33..0000000 --- a/src/tests/socketblock.cpp +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #include "bu/ito.h" | ||
9 | #include "bu/tcpsocket.h" | ||
10 | #include "bu/tcpserversocket.h" | ||
11 | #include <stdio.h> | ||
12 | #include <unistd.h> | ||
13 | |||
14 | class TstServer : public Bu::Ito | ||
15 | { | ||
16 | public: | ||
17 | TstServer() : | ||
18 | s( 55678 ) | ||
19 | { | ||
20 | } | ||
21 | |||
22 | virtual void run() | ||
23 | { | ||
24 | Bu::TcpSocket c = s.accept( 45, 0 ); | ||
25 | printf("TstServer: Accetped connection.\n"); fflush( stdout ); | ||
26 | |||
27 | sleep( 1 ); | ||
28 | printf("TstServer: Trying to read 10 bytes...\n"); fflush( stdout ); | ||
29 | |||
30 | char buf[10]; | ||
31 | size_t nRead = c.read( buf, 10 ); | ||
32 | printf("TstServer: Got %d bytes...\n", nRead ); fflush( stdout ); | ||
33 | |||
34 | printf("TstServer: Closing connection...\n"); fflush( stdout ); | ||
35 | c.close(); | ||
36 | } | ||
37 | |||
38 | Bu::TcpServerSocket s; | ||
39 | }; | ||
40 | |||
41 | int main() | ||
42 | { | ||
43 | TstServer ts; | ||
44 | |||
45 | ts.start(); | ||
46 | |||
47 | printf("main: Connecting to server.\n"); fflush( stdout ); | ||
48 | Bu::TcpSocket s( "localhost", 55678 ); | ||
49 | |||
50 | printf("main: Sending 4 bytes.\n"); fflush( stdout ); | ||
51 | s.write( "aoeu", 4 ); | ||
52 | |||
53 | printf("main: Sleeping 10 seconds for good measure.\n"); fflush( stdout ); | ||
54 | sleep( 10 ); | ||
55 | } | ||
56 | |||