Jump to content
TrinityCore

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


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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...