Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am writing a program that allows users to supply a list of hostsname or IPs which I will then find out which host connectivity is faster and connect to it.

And right as I am typing the question in the title, I thought that pinging might be a possibiity, but what other methods can I use since not all hosts respond to pings?

There are a bunch of website that calculate distance between 2 IPs, how does that work?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The network distance is measured in number of hops. A tool like traceroute sends ICMP packets with varying TTL values. TTL values gets decremented whenever it is forwarded by another hop (router). When TTL reaches zero, the sender is notified by another ICMP packet (Time exceeded error). Have a look at this page.

The other option is to measure the delay between two nodes. This highly depends on the protocol used and does not give the same result for all protocols for several reasons. For example, different protocols are not given the same priority. Also, different protocols have different connection natures (connection-less vs connection oriented) and so on.

share|improve this answer

I think that you're going the long way around to fix a problem. If you are taking a list of user supplied IPs and then finding out which has the lowest latency, you have to decide what services on these hosts you will be using. Ping would be my guess, but as you point out, they might not respond to that. So what are they responding to? HTTP? Then time that.

share|improve this answer
    
Will be connecting on TCP consuming the services of a custom database provider. How to time a TCP connection? Send a request and then start a timer? –  Jake Dec 2 '11 at 19:10
    
If you definition of "faster" is the time it takes to reply to a custom database request, then time that. That's how you'll know which one is faster. (If you have cooperation with the other end, ask them how to tell. Perhaps they'll even offer you a specific query for that purpose.) –  David Schwartz Dec 2 '11 at 20:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.