Qt first connection request web api slow return of the first problem-solving Win7 HttpWebRequest connection is slow, the problem timeouts

Project uses QNetworkAccessManager QNetworkRequest call web api. Program a long time to return a result (a very simple web interface) for the first time requested webapi had some machines. The performance of win10 machine request to return soon, some win7 return soon, but there is a test machine colleague win7 system first request is very slow. QT thought it was a problem (with the QT because it took less than a month). Later, using C # to write a test first request or will be very slow on simple Demo colleagues also tested the machine with HttpWebRequest. At this time I mean to QT should not be a problem. Machine environment should be a problem. That in the end is what the environmental issues it

In the case of the Internet search a bit c # requests related issues. Sure enough, there are similar problems. Win7 solve the first time HttpWebRequest slow connections, timeouts and other issues .

The above system and may be different "default proxy and user authentication policies" related. So we will not set the proxy.

(A) c # solutions in close Proxy manually coding.

 var req = WebRequest.Create("http://www.google.com") ;
 req.Proxy = null;

(B) QT in solution

QNetworkAccessManager *networkAccessManager=new QNetworkAccessManager();

networkAccessManager->setProxy(QNetworkProxy::NoProxy);

Reference  Qt's QNetworkProxy (Network Agent)

Guess you like

Origin www.cnblogs.com/wzxNote/p/12091672.html