This program is intended to check a port and return a non-zero status if the MUD is not running. Specifically, it will return 5 if it successfully did everything it tried to do, including binding to the port. If it bound a socket to the port, then that port is not in use, and thus the MUD is not running.
Usage: porttester <port>
eg. porttester 4201
An example batch file (mudcheck.bat) shows how you might test the port every minute ...
soon 60 cmd /c "c:\pennmush\mudcheck.bat" c:\pennmush\porttester 4201 if not errorlevel 1 goto running c:\pennmush\pennmush /run :running
The above batch file assumes you have the Scheduler service running (on NT) and also have obtained the program soon.exe from the Windows NT Resource Kit.
It also assumes you have put the porttester program in the MUD directory, along with the batch file itself. (In this example, the directory is c:\pennmush).
The program soon.exe lets you schedule the batch file to run again in 60 seconds (or some time interval you choose).
You might customise the batch file a bit for your own needs, for example, replace the interval of 60 seconds with 120 seconds (2 minutes) to reduce the load on the system (slight though it would be).
You would need to change the port number and path to be appropriate for your mud.
If you normally run the MUD as a service you might replace /run with /start.
This program has been compiled and tested under Windows NT using Visual C++ 6.0.
To download, click on the "downloads" button at the top of this page.
This program is supplied free of charge. It is copyright 1999 by Nick Gammon. Source code is available from the downloads area.
Comments to Gammon Software support
Page updated on Wednesday, 15 December 2004