1

I am attempting to write a price listener.

the data arrives as a 'push' response, ie: chunked transfer-encoding. i have decided to use the http server api, as both async wininet and winHTTP read data apis both close the connection if there is no data for a short while.

first of all, am i correct to use the http server api?

second, if i try to, as per the msdn example:

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

i always get a sharing violation. do i need to use netsh to configure the connection somehow? if so how? ive seen mention of configuring http.sys, and ive even tried executing the above code as an administrator.

I would be extremely grateful for some help, as there seems very little code out there for this!

Many thanks, Jon

jonsl
  • 23
  • 1
  • 4

1 Answers1

0

This error happens if the port is already in use by another process. That means another application uses the port (for example IIS or another web server).

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670