I have a server and a website running 100% fine.
The thing is, I want my website to show on the default page “Status” of the server. I was thinking about pinging the server with this code:
Uri url = new Uri("http://www.abhigrgrgrgrgsheksur.com");
string pingurl = string.Format("{0}", url.Host);
string host = pingurl;
bool result = false;
Ping p = new Ping();
try
{
PingReply reply = p.Send(host, 3000);
if (reply.Status == IPStatus.Success)
return true;
}
catch { }
return result;
The code is from a website I found online, not mine.
The thing is, if you put that code on the default page on the website, when people do “Reverse” its always pings the server, my question is, can it drop the server? Or get it stop working? Or anything like that? The server is not a website. It’s a running process (MineCraft Server).
If I understood correctly your worried about on every refresh of page it will ping and multiple ping call will be made
So the statement made in Remarks paragraph for Ping Class at http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx might help your concern
You cannot use the same instance of the Ping class to generate multiple simultaneous ICMP Echo requests. Calling Send while a SendAsync call is in progress or calling SendAsync multiple times before all previous calls have completed causes an InvalidOperationException.