OSDN Git Service

socket_test.cpp
authormyun2 <myun2@nwhite.info>
Mon, 9 Jul 2012 00:15:20 +0000 (09:15 +0900)
committermyun2 <myun2@nwhite.info>
Mon, 9 Jul 2012 00:15:20 +0000 (09:15 +0900)
roast/include/roast/io/socket/socket.hpp
roast/test/socket_test/socket_test.cpp

index fd60d15..e29626d 100644 (file)
@@ -86,6 +86,11 @@ namespace roast
 
                /////////////////////////////////////////////////
                
+               void open(const open_params_type& param)
+               {
+                       close();
+                       _Base::open(param);
+               }
                void open(const char* host, int port)
                {
                        close();
index 21220ad..7d0988a 100644 (file)
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <memory.h>
 #include "roast/io/socket.hpp"
 
 using namespace roast;
@@ -6,7 +7,12 @@ using namespace roast;
 int main()
 {
        try {
-
+               roast::io::socket s("localhost", 80);
+               s.send("GET / HTTP/1.1\r\n\r\n");
+               char work[1024*16];
+               memset(work,0,sizeof(work));
+               s.read(work,sizeof(work));
+               printf("%s\n", work);
        }
        catch(roast::exception &e)
        {