Changeset 1329:361ff71dbc44
- Timestamp:
- 09/03/09 06:07:48 (2 years ago)
- Branch:
- default
- Children:
- 1330:112784adfac8, 1345:b24305dd9edb
- Location:
- trunk/tests
- Files:
-
- 2 edited
-
ionetworkclient_test/test.cc (modified) (1 diff)
-
ionetworksslclient_test/test.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/ionetworkclient_test/test.cc
r1312 r1329 18 18 try 19 19 { 20 try 21 { 22 client c(connection::PROTOCOL_FAMILY_IPV4, connection::TRANSFER_STREAM); 23 exchange ex; 24 dodoString str; 20 dodoString host = "kernel.org"; 25 21 26 try 27 { 28 c.connectFrom("127.0.0.1", "127.0.0.1", 21, ex); 22 cout << host << ":" << tools::network::hostPrimaryIp(host) << endl; 29 23 30 str = ex.readString(); 31 cout << "\n" << str << "\n"; 32 } 33 catch (dodo::exception::basic ex) 34 { 35 cout << (dodoString)ex << "\t" << ex.line << endl; 36 } 37 } 38 catch (dodo::exception::basic ex) 39 { 40 cout << (dodoString)ex << "\t" << ex.line << endl; 41 } 24 client st(io::network::connection::PROTOCOL_FAMILY_IPV4, io::network::connection::TRANSFER_STREAM); 25 26 exchange ex; 27 dodoString str; 28 29 st.connect(tools::network::hostPrimaryIp(host), 80, ex); 30 31 str = "GET / HTTP/1.1\r\n"; 32 ex.blockSize = str.size(); 33 ex.write(str); 34 35 str = "Host: " + host + "\r\n"; 36 ex.blockSize = str.size(); 37 ex.write(str); 38 39 str = "Connection: Close\r\n"; 40 ex.blockSize = str.size(); 41 ex.write(str); 42 43 str = "User-Agent: " PACKAGE_NAME "/" PACKAGE_VERSION "\r\n\r\n"; 44 ex.blockSize = str.size(); 45 ex.write(str); 46 47 ex.blockSize = 512; 48 str = ex.readString(); 49 50 cout << tools::misc::split(str, "\r\n\r\n")[0] << endl; 42 51 } 43 52 catch (dodo::exception::basic ex) -
trunk/tests/ionetworksslclient_test/test.cc
r1328 r1329 60 60 ex.write(str); 61 61 62 ex.blockSize = 4096; 62 63 str = ex.readString(); 63 64 64 cout << str<< endl;65 cout << tools::misc::split(str, "\r\n\r\n")[0] << endl; 65 66 #endif 66 67 }
Note: See TracChangeset
for help on using the changeset viewer.
