Check if a server is offline

Discussion in 'Plugin Development' started by Forseth11, Jan 3, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Forseth11

    How would I check if a server is offline. I tried using sockets, but it kicks everyone if the server is offline because of lag. How would I go about doing this with Bukkit?

    I made a thread exactly like this, but for some reason it got locked before I could respond. Someone said something about netIO inside separate thread (async task). Can someone give me an example.
    Another person said something about sockets. I tried that. By the time it times out the players time out.
    Another guy said Use separate thread and ping the server. How would I do that.
     
  2. Offline

    tommycake50

    I think that pinging the server is definitely the best way to do it.
    Luckily minecraft server has it's own ping feature(How client's ping servers).
    Take a look at the documentation here: http://wiki.vg/Server_List_Ping.
    They way to ping should be self explanatory if you are familiar with sockets(And you might want to do it on a seperate thread).
    (Please look at java examples!).
     
  3. Offline

    Forseth11

    tommycake50 Okay that makes somewhat sense. How would I put this into a plugin? Can you give an example?
     
  4. Offline

    tommycake50

    The page gives you a java example, if you were to copy and adapt that a bit then you would be able to create a class with all the methods you need to perform a ping .
     
  5. Offline

    Forseth11

    tommycake50 Okay. I did not see the example.

    EDIT: I meant to say I did not see it at first, but I found it.
     
Thread Status:
Not open for further replies.

Share This Page