Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/125.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ HttpAddUrl失败,出现错误\u共享\u冲突(32L)_C++_Winapi_Http_Winhttp - Fatal编程技术网

C++ HttpAddUrl失败,出现错误\u共享\u冲突(32L)

C++ HttpAddUrl失败,出现错误\u共享\u冲突(32L),c++,winapi,http,winhttp,C++,Winapi,Http,Winhttp,我试图写一个价格监听器 数据以“推送”响应的形式到达,即:分块传输编码。 我决定使用http服务器api,因为如果短时间内没有数据,异步wininet和winHTTP读取数据api都会关闭连接 首先,我使用http服务器api正确吗 其次,如果我尝试,根据msdn示例: retCode = HttpInitialize( HttpApiVersion, HTTP_INITIALIZE_SERVER, NULL

我试图写一个价格监听器

数据以“推送”响应的形式到达,即:分块传输编码。 我决定使用http服务器api,因为如果短时间内没有数据,异步wininet和winHTTP读取数据api都会关闭连接

首先,我使用http服务器api正确吗

其次,如果我尝试,根据msdn示例:

retCode = HttpInitialize( 
            HttpApiVersion,
            HTTP_INITIALIZE_SERVER,
            NULL
            );    // return is NO_ERROR

retCode = HttpCreateHttpHandle(
            &hReqQueue,
            0
            );    // return is NO_ERROR

std::wstring url = _T( "http://apidintegra.tkfweb.com:80/" );
retCode = HttpAddUrl(
            hReqQueue,
            url.c_str(),
            NULL
            );    // always fails with ERROR_SHARING_VIOLATION
我总是受到分享违规。我是否需要使用netsh以某种方式配置连接?如果是,怎么做?我看到有人提到配置http.sys,我甚至以管理员的身份尝试执行上述代码

我将非常感谢您的帮助,因为这方面的代码似乎很少

非常感谢,,
Jon

如果端口已被其他进程使用,则会发生此错误。这意味着其他应用程序使用该端口(例如IIS或其他web服务器)