Objective: I want to make a java program containing a boolean that checks every 5 minutes to see if my games server (cloudnine1999.no-ip.org:port 43594)
Purpose: To restart my game server if it crashes
Problem: Not sure how to check if a server is online using java.
Programs Function: If the boolean returns false(meaning the server is offline) I want the java program to open a specific batch file so the server starts up(in case the server crashes)
I tried finding something on google but I didn’t find anything helpful and I’m not quite advanced enough of a coder to figure this out on my own, all I need is someone to instruct me/point me in the right direction of coding a server status checker with java and I can do the rest from there.
I may not be able to respond to your answers until around 4PM Central Us&Canada time zone.
Use
Socketto check if the server is up (if it can connect to the IP and Port without throwing an exception). Be careful, some servers don’t like these ’empty’ connections.Use
ProcessBuilderto start it up again.