C# WebClient acting slow the first time

后端 未结 3 1200
清酒与你
清酒与你 2020-12-10 12:55

I am using a WebClient to download a string from a website (which just contains plain text, nothing else), so I use the DownloadString method:

WebClient wc =         


        
3条回答
  •  醉话见心
    2020-12-10 13:23

    Well, the first time it needs to do a DNS lookup and connect to the host - after that, within the same process it may well be reusing the same connection. For the very first request to anywhere, it may well also be trying to detect proxy settings etc.

    If you want to see what's really happening at the network level to make it slow, I suggest you grab Wireshark and monitor the traffic with that.

提交回复
热议问题