• Checking if a process is 'frozen'
    8 replies, posted
I'm trying to make a little program for our Garry's Mod servers. We already have a process manager that restarts the servers if they terminate for some reason, but this doesn't work when they 'freeze up', meaning the window is still there (and the process still running), but it doesn't respond any more. My goal is to write a little app that terminates the process once it stops responding for a specific amount of time. How would I do this? Or is there an easier way than writing your own app?
I don't know about any easier way, but you could let Lua write the time to a file periodically and poll that with your program.
You could also try opening a connection to port 27015 (I'm not sure whether TCP or UDP) You won't need to send any data, just open the socket. If it's accepted, the server is up
You could write this rather easily with a TCP / IP socket to connect to the server in Java. :3:
Trying to establish a connection to the server is definitely the way to go.
if this is just for srcds, open a socket to port 27015 udp and send "\xff\xff\xff\xffTSource Engine Query\x00", if you get nothing back it's probably frozen.
If you wanna look on C# code that does what you want, take a look here: [url]http://forums.srcds.com/viewpost/77635#pid77635[/url] Some random stuff I made a while back. The solution files are VS2010
[QUOTE=andersonmat;20490985]You could write this rather easily with a TCP / IP socket to connect to the server in Java. :3:[/QUOTE] Or any other language for that matter
Yeah, a basic program that just opens the socket to see if it's online. But the best way would be to open it local, as i see it. It could cause problems if the server just failed at the moment to send out any data.
Sorry, you need to Log In to post a reply to this thread.