views:

459

answers:

1

How can I check latency between server and client using asp.net. I would like to ping the server from the client and get back the results. Is this possible?

I can ping the ip address of the client but obvisouly this doesn't work for numereous reasons. For example on speedtest.net they check latency and report back milliseconds I would like to aceive the same thing.

string strClientIP = Request.UserHostAddress;
Ping ping = new Ping();
PingReply pr;
pr = ping.Send(strClientIP);
A: 

How about looking at http://www.aspnettutorials.com/tutorials/network/net-ping-aspnet2-csharp.aspx?

Edit: you don't really need ASP.NET here, persay. All the interesting stuff will be done with C#.

Is this more like what you're looking for?

Matt Ball
This code is the same I pasted above. I need to ping client -> server not server -> because ping maybe turned off on client for example.
Skiltz
I'm confused as to how you're distinguishing client and server. Are you considering the client to be the machine that you're serving ASP.NET pages to? This really doesn't seem like the kind of thing you'd really bother with doing client-side. Are you essentially trying to ping from a browser?
Matt Ball
Server = IISClient = Vistor to website.I can't ping from Server to Client becuase often Ping is turned off on client.
Skiltz
See what i am trying to acheive here. http://ping.agentx.co.nz
Skiltz
I still think the best way to do it is with a server-initiated "ping." You don't need to use an actual ICMP ping to do it. You can just write basic similar functionality on your application layer. If you read the FAQs (like http://www.broadbandgenie.co.uk/speedtest) for speedtest.net-like sites, it's not done using ICMP ping.speedtest.net/about.php uses third-party software (http://www.ookla.com/) to do it.
Matt Ball
Oh, and here is the basic methodology of how ookla does it: http://wiki.ookla.com/test_flow
Matt Ball