我正在尝试写一个价格监听器。
数据作为“推送”响应到达,即:分块传输编码。我决定使用 http 服务器 api,因为如果短时间内没有数据,异步 wininet 和 winHTTP 读取数据 api 都会关闭连接。
首先,我使用http server 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,我什至尝试以管理员身份执行上述代码。
我将非常感谢您的帮助,因为这方面的代码似乎很少!
非常感谢,乔恩