Download sources from servers that don't respond to ping

Perry Lee perry at macports.org
Mon Oct 5 15:15:28 PDT 2009


Ryan Schmidt wrote:
> "curl --head" could be used to determine whether we can connect to a 
> server, but it doesn't give you a quality indication that could be used 
> to rank multiple available servers. "ping" tells you how many 
> milliseconds it took to reach the server, which is how we sort distfile 
> servers today. You might be able to use "time" to time a curl command, 
> but I have a feeling that would be less accurate because it would time 
> the entire curl process, and not just the network access part like 
> ping's internal timing does. I'm also fairly sure doing an HTTP or HTTPS 
> or FTP request and response, like curl would do, would take a lot more 
> time than a ping. This is not to say ping is the only solution we should 
> use, but these are probably some of the reasons why it was selected in 
> the first place, and some things to consider when thinking about if it 
> should be replaced.

How about using one of the time_ variables kept track of by curl?

For example (from the man page):

time_connect: The time, in seconds, it took from the start until the TCP 
connect to the remote host (or proxy) was completed.


More information about the macports-dev mailing list