0

I am working on an MVC 5 site, which will ping remote servers/machines and display the response information. I would like to achieve a system that pings, not from the server, but from the client's computer accessing the site.

I currently using code very similar to the following:

string ipaddress;
Ping ping = new Ping();
PingReply reply = ping.Send(ipaddress);

This appeared to be working fine. However I tested the website from multiple computers at different locations, as well as from my phone. I found that all devices show virtually the same latency in ping requests.

I would expect at the very least my phone would have much higher latency than the computers I tested, but I would also expect the computers to have somewhat different latency as well.

This leads me to believe that the Ping() and PingReply() are actually being sent from the server instead of the client. Am I correct in this assumption? And if so is there any way to achieve a Ping() and PingReply() from the client instead?

tereško
  • 58,060
  • 25
  • 98
  • 150
  • 1
    If this is written in server-side code then, yes, it seems reasonable that it's being executed server-side. A quick Google search (https://www.google.com/search?q=javascript+ping+ip) seems to indicate that JavaScript has no *direct* means of pinging a host, since the browser's API doesn't support it. But there appear to be some potential workarounds to get you close. – David Dec 08 '14 at 15:50
  • 1
    http://stackoverflow.com/questions/4282151/is-it-possible-to-ping-a-server-from-javascript – Xavjer Dec 08 '14 at 15:50
  • possible duplicate of [How to ping IP addresses using JavaScript](http://stackoverflow.com/questions/4954741/how-to-ping-ip-addresses-using-javascript) – David Dec 08 '14 at 15:51

0 Answers0