[Home] [Downloads] [Search] [Help/forum]

PORTINFO - a port watching utility


Purpose

This program is designed to be used by server or MUD administrators when a MUD or MUSH is down for some reason, or has relocated. The program listens on specified ports and if someone attempts to connect, sends a message and then disconnects immediately. The message could be something like "server down, please try again later", or "this game has moved to xxx.yyy.zzz port 1234".


Design

The program is written for Win32 (Windows 95 or Windows NT). It uses multiple threads (one per port, and briefly, one per connection) to easily monitor many ports, if necessary.

It can be installed as a service, if it is needed to be run for lengthy periods (eg. if a MUD has moved to a different server altogether). Services can only be used on Windows NT. If you need to have the program running constantly on Windows 95, place it in your Startup folder.


How to use

The program reads a configuration file: PORTINFO.CFG

This file must be in the same directory as the PORTINFO.EXE file.

Each line in PORTINFO.CFG specifies a port to be monitored. It consists of a port number, followed by a filename. The filename is the name of a file, whose contents are sent to anyone connecting on that port. Comments may be used, if they start with a # at the start of the line.

eg.

You may have any number of ports monitored. Multiple ports may share the same file name, as shown in the example.

The files with the messages in them should be ordinary text files, they will be sent "as is". The contents of the files are loaded into memory when the program starts up. If you change the file contents, you will have to stop PORTINFO and restart it.

Once the program is running, the main thread is waiting on keyboard input. Just press <enter> and the program will wrap up and exit.


How to install as a service

On Windows NT, you can install it as a service. This means it will automatically start up when the system is booted, even if no-one logs in. To do this, use a command prompt window, and type:

PORTINFO /INSTALL
PORTINFO /START

You can subsequently stop it, by typing:

PORTINFO /STOP

To remove the service, type:

PORTINFO /REMOVE

To see if it is running, type:

PORTINFO /STATUS

You can see a summary of commands by typing:

PORTINFO /HELP

Service suggestion

If you are planning to run PORTINFO as a service, initially test it stand-alone, by typing:

PORTINFO /RUN

That way, any errors in the configuration file (port in use or whatever) will be displayed on the screen. If you get no errors, then go ahead and install it as a service, if that is what you want to do.


Log file

If running as a console application, PORTINFO displays a message for each attempted connection for a port, along with the date and time. The output will look like this:


Starting  listening thread for port 4201...
Connect from: 127.0.0.1 - port 4201 at Wednesday, April 01, 1998, 2:09 PM
Connect from: 127.0.0.1 - port 4201 at Wednesday, April 01, 1998, 2:09 PM
Connect from: 127.0.0.1 - port 4201 at Wednesday, April 01, 1998, 2:09 PM
Connect from: 172.16.10.12 - port 4201 at Wednesday, April 01, 1998, 2:09 PM
Connect from: 172.16.10.12 - port 4201 at Wednesday, April 01, 1998, 2:09 PM

If running as a service, PORTINFO writes to a log file named PORTINFO.LOG. You can check that file periodically to see whether people have been attempting to connect.


Testing the program

Once you have the program running successfully, use Telnet (or your MUD client program) to connect to your PC, using the appropriate port number. You can connect to your own PC by connecting to 127.0.0.1


Availability

To download, click on the "downloads" button at the top of this page.


Fee

This program is supplied free of charge. It is copyright 1998 by Nick Gammon. Source code is available from the downloads area.


[Back] [Home]
Written by Nick Gammon - 5K

Comments to Gammon Software support

[Best viewed with any browser - 2K]    Internet Contents Rating Association (ICRA) - 2K    [Hosted at HostDash]

Page updated on Wednesday, 15 December 2004