how does Ping work?



how does Ping work?

In: Technology

Imagine that you want to see how fast the post office is, so you mail your friend a letter that says “Hey – send this back to me as soon as you get it.” As soon as you drop it in the mailbox, you start a stopwatch.

When the letter comes back, your stopwatch says it’s been six days, so your ping is six days.

Internet ping is exactly that, only with an electronic signal from your computer to some faraway computer and back again. For most games, 20-50 millisecond ping is good, 100 milliseconds is getting too slow for fast-reaction games like shooters or Street Fighter, and up around 300-400ms even non-reaction games can get a little annoying.

The word comes from submarine sonar, where you send out a sound pulse (which, inside the sub, sounds like ‘ping’) and time how long it takes to reach an object and bounce back, and the time interval tells you the range.

The command in a command line interface, or actual ping between computers/networks? I’ll explain both, since they go hand in hand

Command line interface : It sends a packet (a small piece of data) that says “reply to me” from one host to another, and measures the time it takes to receive that reply, or even says it never received a reply after a predetermined amount of time passes.

Ping between networks/hosts : Information can only be sent and received at such a high speed, and when you have routers and switches moving that information around and processing it, it all adds a little bit of latency from initially sending the information from one device to another.

It’s like two people standing across a road. The fist person (frank) yells “hello Jim”. The second person (Jim) will reply “hi Frank” if he can hear Frank. Frank will know the two can converse if Frank hears Jim’s reply. No reply? Frank has no idea if Jim can hear him or is being ignored.

Late Edit. Yeah I even confused myself editing this.

In computer networking it sometimes becomes interesting to know how far away another computer is. This does not really mean how far away it is physically (although that does figure into it), but how long it takes for information you send to reach it.

The way to find this out is to send a simple message that the other computer will echo back to to you and measure how long it takes for the echo to come back to you.

The logic behind that is the same as sending out radar or sonar to find airplanes or submarines. You send a signal, the object reflects it back and you learn how far away it is by measuring how long it takes.

It is the same sort of logic that you get when (in stories) you come across a dark hole that you can’t see the bottom of and want to find out how deep it is. You drop a rock and wait and listen for the sound of it hitting the bottom. The longer it takes until you hear the sound the father away the bottom is.

With computers it isn’t really used to measure physical distance, because, but how long it takes for a signal to travel from your computer to the destination and back.

Ping is also often used as a simple diagnostic to figure out if the computer at the other end is there at all and echoing you pings.

The ping program on computers sends out a bunch of pings (4 is the default on windows) to a specified target and tells you how long it took from them to be send back and how many returns you received at all.

If no returns come that can mean that the other computer is turned off or configured not to echo pings back, or that something in between you two filters them out.

If only some pings are returned, that means something is not entirely right with the connection.

If the time it takes for a ping to return to you is very long that means that the other computer is far away or connected in a less than optimal route or something.

Signals in copper wire travel at a significant fraction of the speed of light and are still pretty fast in optical fiber cables.

If it was just that a computer at the other side of the planet should have a ping of less than 150 ms.

However signals get slowed down by the switches and routers the pass though and cables rarely connect computers directly in a straight line by taking the shortest path.

The time it takes for a message to travel from your computer to one far away can be quite big.

This is not really a big issue for things like web-browsing or sending email or similar, but if you are playing games online or trying to remotely control some dumb physical machine far away that can be a problem.

In competitive games learning what is happening 1/10th of a second later than your opponent can be a game breaker.

So online gamers are very aware of the need to have a low ping.

Other groups who really want a low ping include high frequency traders who have in the past gone though quite a lot of trouble and spend a chunk of money to connect exchanges the fastest way possible. Time is quite literally money in that business.

Unfortunately there is only som much anyone can do to lower a ping between two computers short of physically moving the computer closer together. Your ping to a server on another continent is never going to be as low as the one to a computer in the room (unless you screw up the cabling to the room really badly).