win32 socket http 操作

  • 时间:
  • 来源:互联网
  • 文章标签:
纯wininet 操作http关键代码如下:

 

HINTERNET hNet = ::InternetOpen(_T("Test"), INTERNET_OPEN_TYPE_DIRECT,NULL, INTERNET_INVALID_PORT_NUMBER, 0);
HINTERNET hUrlFile = ::InternetOpenUrl(hNet,_T("http://192.168.1.12/Config.txt"),NULL,  0,INTERNET_FLAG_RELOAD, 0);
  char buffer[10 * 1024];
  DWORD dwBytesRead = 0;
  BOOL bRead = ::InternetReadFile(hUrlFile,buffer,sizeof(buffer),&dwBytesRead);

::InternetCloseHandle(hUrlFile);
::InternetCloseHandle(hNet);

 

转载于:https://www.cnblogs.com/larkin/p/11583000.html

本文链接http://www.taodudu.cc/news/show-647733.html