I thought about the question: how many countries will have to go through one network packet from the moment they are entered into the
habrahabr.ru browser and to the friendly flashing of the diode on the Tom Server itself.

The journey began with a wireless router in my hallway. Then - Ukrtelecomov server (he wished to remain hidden). Then, bypassing Budapest, the bag went to the States. Looped not long there, and having flown to Germany and London, settled in Russia somewhere.
')
How it works and links to source codes / demo read under a cat.
The answer to the question was a combination of three things: Tracert, the service ipinfodb.com and Silverlight. Let us dwell on them in more detail.
Tracert
Tracert (traceroute) is a utility that shows the package path to the specified service. Here is the result of its implementation:
C:\Users\anvaka>tracert -d habrahabr.ru
Tracing route to habrahabr.ru [178.248.233.33]
over a maximum of 30 hops:
1 2 ms 2 ms 2 ms 192.168.1.1
2 * * * Request timed out.
3 140 ms 139 ms 142 ms 10.50.19.2
4 155 ms 157 ms 154 ms 212.162.26.1
5 175 ms 170 ms 167 ms 4.69.141.250
6 186 ms 177 ms 179 ms 4.69.140.6
7 177 ms 171 ms 168 ms 4.68.23.75
8 83 ms 83 ms 81 ms 212.162.40.142
9 91 ms 92 ms 91 ms 91.194.117.130
10 180 ms 181 ms 182 ms 178.248.233.33
The essence of her work is simple. The program sends a series of ICMP packets (the same ping) to the target host (habrahabr.ru), each time increasing the TTL (time to live) of the packet by one. The intermediate server, passing the packet through itself, reduces this parameter by one. If the TTL reaches zero, the server responds to the sender that the packet lifetime is, alas, completed. This is where the tracert records who sent the sad news.
In the example above, tracert sends the first series of three packets, with a TTL of one. My router in the hallway immediately replies: “the package has expired”. We remembered the helmet and the second series of packages. Now TTL is two. My router allows the packets to go on, but the next router should wrap us back. This continues until we reach the target host.
By the way, in my case, the second router did not want to answer. This also happens. Often, for security reasons, to prevent intruders from gaining information about the network architecture, administrators block such requests.
IPInfoDB
By itself, the output of the tracert program is a good help in diagnosing problems in the network. However, from it you can not know the geographical location of intermediate servers. As far as I know, there is no single centralized repository with similar information (except, perhaps, the FBI databases. But they have not yet laid out on wikileaks). From free services, with open API, I really liked
ipinfodb.com . According to REST, you can transfer the IP address of interest and, often, get its geo-position. Of course, for reserved addresses (192.168.xx, etc), your location will be somewhere in the Atlantic Ocean - this is where the center of the Earth must be.
Silverlight
Silverlight is a platform from Microsoft,
for which there is minus, which is about to replace HTML 5. Joke. Silverlight will be still long on the market and will be bright (
TODO yourself: re-read this post after a couple of years ). This is a topic for a separate holivar and, anyway, I love them both :)
On Silverlight, I made friends tracert and IPInfoDB. Of course, you have no right to run programs / send packages directly from the browser. The application needs an increased level of trust for such operations. Therefore, it works only outside the browser.
To run tracert I use COM Automation. And this, alas, means that macro users remain with a non-working application. Through COM, a
WScript.Shell
object is
WScript.Shell
, and the
tracert
command is executed. Unfortunately, the script engine from me is useless: I never found a way to not show the console window, at the same time getting stdout.
In the course of receiving a new output from tracert, the application asynchronously sends requests to IPInfoDB with a request to provide geodata. As soon as the data is received, a new marker is added to
Bing Maps :

From the point of view of the code (link below), the main process of interaction looks like this:

Links
- The source code of the program can be downloaded here . You can use it for any purpose. You will need Bing Maps Silverlight Control to compile. I would be grateful if you let me know what you think.
- A demo version of the site is available here . After the trace is completed, hover the mouse over the package location indicator to get the name of the position. Checked performance under Windows 7 (Eng), and Windows Vista (Rus). As mentioned above, the program requires installation on the desktop.
Instead of conclusion
It is worth noting that the program is not an absolutely reliable indicator of the package route. The route itself may change several times during the interaction of the client / server. The IPInfoDB database does not guarantee the accuracy of its data. Well, the program itself is damp: it was written for fun, not production code.
Well, well, I showed the countries / cities along the route, well, what do I get from this? - You know, when you work on data visualization, you often don’t suspect what question you will come to. Those. visualization does not teach the right answer. Rather, it helps to find the right questions that I hadn’t thought about before. I do not know what questions you have, and what answers you will find. But sincerely I hope you enjoyed your time here.
ZYZH By the way, when you evaluate the article, think not only about how the packages will go on the web, but also about how they will affect the author's mood :)