HP-Socket 版本 5.3.2
HttpSyncClient其实并不需要监听器,在使用它访问网页的时候可以这样做:
1 std::string GetHTML() 2 { 3 CHttpSyncClientPtr __http_sync_request(nullptr); 4 if (__http_sync_request->OpenUrl("GET", "http://xxxx.xxxx.xxxx", nullptr, 0, nullptr, 0, TRUE) == FALSE) 5 return ""; 6 BYTE * __resp_body_ptr = nullptr; 7 int __body_length = 0; 8 if (__http_sync_request->GetResponseBody((LPCBYTE*)&__resp_body_ptr, &__body_length) == FALSE) 9 return ""; 10 std::string htxt((char*)__resp_body_ptr, __body_length); 11 return htxt; 12 }