C 使用wininet连接到Internet
我已经使用Python的SimpleHTTPServer在我的笔记本电脑上设置了一个127.0.0.1:8000的临时服务器。我写了一个小C程序,试图连接到服务器 然后看看那里的一个文件,C 使用wininet连接到Internet,c,wininet,getlasterror,C,Wininet,Getlasterror,我已经使用Python的SimpleHTTPServer在我的笔记本电脑上设置了一个127.0.0.1:8000的临时服务器。我写了一个小C程序,试图连接到服务器 然后看看那里的一个文件,d.txt。但是,我的程序没有正确连接HttpSendRequestA抛出ERROR\u SXS\u KEY\u NOT\u FOUND(00002EE7)但问题更严重 #include <stdio.h> #include <stdlib.h> #include <unistd.
d.txt
。但是,我的程序没有正确连接HttpSendRequestA
抛出ERROR\u SXS\u KEY\u NOT\u FOUND(00002EE7)
但问题更严重
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <wininet.h>
int main(void) {
HINTERNET* openHandle;
openHandle = InternetOpenA("Windows+NT+5.1",0, NULL, NULL, 0);
HINTERNET* connectHandle;
connectHandle = InternetConnectA(openHandle,"127.0.0.1",8000,NULL,NULL,0,3,0);
HINTERNET* httpHandle;
char* arr[] = {"text//*", NULL};
httpHandle = HttpOpenRequestA(connectHandle, "GET", "d.txt", "HTTP/1.1", 0,
arr,0,0);
int result2;
result2 = HttpSendRequestA(httpHandle, 0,0,0,0);
printf("%d",result2);
return EXIT_SUCCESS;
}
#包括
#包括
#包括
#包括
#包括
内部主(空){
HINTERNET*openHandle;
openHandle=InternetOpenA(“Windows+NT+5.1”,0,空,空,0);
腹地*连接手柄;
connectHandle=InternetConnectA(openHandle,“127.0.0.1”,8000,NULL,NULL,0,3,0);
HINTERNET*httpHandle;
char*arr[]={“text/*”,NULL};
httpHandle=HttpOpenRequestA(connectHandle,“GET”,“d.txt”,“HTTP/1.1”,0,
arr,0,0);
结果2;
结果2=HttpSendRequestA(httpHandle,0,0,0);
printf(“%d”,结果2);
返回退出成功;
}