WinHttpSendRequest WinHttpWriteData原理

std::string strExtInfo ="sfdfsdffffffffffsfdfdf";
if (WinHttpSendRequest(hConnect, L"Content-Type: application/octet-stream", -1L, WINHTTP_NO_REQUEST_DATA, 0, strExtInfo.length(), 0)) {
char buf[100];
strcpy(buf,"123456789");
// if (WinHttpSendRequest(hConnect, WINHTTP_NO_ADDITIONAL_HEADERS, -1L, buf, strlen(buf), strlen(buf), 0)) {


// if (WinHttpSendRequest( hConnect,WINHTTP_NO_ADDITIONAL_HEADERS, 0,WINHTTP_NO_REQUEST_DATA, 0,0, 0)){


if ( 0 != strExtInfo.length() ) {
// 默认可以一次全部写完
WinHttpWriteData(hConnect, strExtInfo.c_str(), strExtInfo.length(), NULL );
}

posted on 2023-07-31 03:55  lydstory  阅读(118)  评论(0)    收藏  举报

导航