Prevent multiple DNS lookup

  • Thread starter Thread starter Franz
  • Start date Start date
F

Franz

Dear all,

I want to use WebClient.DownloadFile to download multiple files from a
single host. In order to prevent multiple dns lookup, I get the ip of the
host by using Dns.GetHostByName. If I replace the host name of the url by
the ip address and use WebClient.DownloadFile to download the files, it
won't perform dns lookup, will it?

Thanks.
Franz
 
Hello!
You wrote on Mon, 4 Jul 2005 11:29:48 +0800:

F> I want to use WebClient.DownloadFile to download multiple files from a
F> single host. In order to prevent multiple dns lookup, I get the ip of
F> the host by using Dns.GetHostByName. If I replace the host name of the
F> url by the ip address and use WebClient.DownloadFile to download the
F> files, it won't perform dns lookup, will it?

If you remove the host name from the URL, how is the client create Host:
header for HTTP request?

With best regards,
Eugene Mayevski
 
You are attempting to improve efficiency, right?

It is possible that you won't see the benefits you seek using this
technique.

a) I'm pretty sure that DNS entries are cached locally. Once looked up, the
system won't go get them again for a while. (I don't know the duration off
the top of my head).

b) many web sites require that you use the DNS name to refer to resources,
rather than using the IP address. This is used for host headers as well as
coded options within the site. Developers do a lousy job of testing for the
possibility that a person will develop an app that does NOT behave like a
browser. Replacing the dns name with the IP address will sometimes fail as
a result.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
Back
Top