Jump to content
TrinityCore

[C#] How to check if the server is open


detonatorss
 Share

Recommended Posts

So what i should have to do?

how do i can check if the server is open, if i do a ping it ping to host, not to the server, so what you recomend me?

 

Ping pingSender = new Ping();
IPAddress address = IPAddress.Parse("127.0.0.1");
PingReply reply = pingSender.Send(address);

if (reply.Status == IPStatus.Success)
   {
         serverStatus.Checked = true;
   }
   else
   {
        serverStatus.Checked = false;
   }

Edited by detonatorss
Link to comment
Share on other sites

CDawg : I think he want to know if a TC server is running on the server, to display a "Server Online/Offline" message

You can't just ping, ping will just tell you your hardware is up and can response. If you want to specifically check if TC is running, you must check if the server is listening on worldserver port (8085 on master if i remember well)

Check this : http://stackoverflow.com/questions/2836674/determine-if-a-server-is-listening-on-a-given-port

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...