diff options
Diffstat (limited to '')
-rw-r--r-- | src/tests/socketbreak.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/socketbreak.cpp b/src/tests/socketbreak.cpp new file mode 100644 index 0000000..82069de --- /dev/null +++ b/src/tests/socketbreak.cpp | |||
@@ -0,0 +1,27 @@ | |||
1 | #include "bu/serversocket.h" | ||
2 | #include "bu/socket.h" | ||
3 | |||
4 | int main() | ||
5 | { | ||
6 | Bu::ServerSocket sSrv( 9987 ); | ||
7 | |||
8 | Bu::Socket sSend("localhost", 9987 ); | ||
9 | |||
10 | Bu::Socket sRecv( sSrv.accept() ); | ||
11 | |||
12 | printf("Connected sockets.\n"); | ||
13 | |||
14 | sleep( 1 ); | ||
15 | printf("Closing sRecv.\n"); | ||
16 | sRecv.close(); | ||
17 | sleep( 1 ); | ||
18 | |||
19 | char buf[3]; | ||
20 | printf("About to write.\n"); | ||
21 | printf("write: %d\n", sSend.write("hi", 2 ) ); | ||
22 | printf("About to read.\n"); | ||
23 | printf("read: %d\n", sSend.read( buf, 2 ) ); | ||
24 | |||
25 | return 0; | ||
26 | } | ||
27 | |||