Here is the script that has served well for me for years (nope, not mine), except now with the web site on a unix shell server, it never displays the status GIF. As near as I can tell it's because the ping is never sent to the remote system. The remote system is mine, it will return a reply and the program on that port will also respond to it .. it always has.
IP needed to ping: 66.216.60.251
PORT needed directed to: 2593
It needs to diplay one of two pics based on a ping reply or not.
I know squat about programming/scripting other then what my game uses and I would do it myself except time contraints prevent the necessary learning period. Soooo, I am looking for a kind soul who can do up one for me.
Here is the original script and readme:
use Socket;
use CGI;
#!/usr/bin/perl
###############################################################################
# PortPing copyright 1998 Eric D. Patterson. (Anarchy inK, 02/1999)
# This program attempts to connect to a socket on a remote server, and returns
# an image indicating wheither that port is currently up or down. Pretty
# simple, but handy, and useful for modification into other scripts.
#
# This script is free for use and mdification so long as this header remains
# unmodified and intact. Anarchy inK, and Eric Patterson will not
# be held liable for distress, loss, or damages that may result from the use of
# this program.
#
# Anarchy inK refers to Anarchy inK Co.
# http://www.anarchyink.com
###############################################################################
# Variables you can edit:
$up = "Location: http://www.michaelmarino.net/tfl/up.gif\n\n";
$down = "Location: http://www.michaelmarino.net/tfl/down.gif\n\n";
###############################################################################
sub checkPort { #checks the status of an input address and port, returns T/F
my ($remote, $port, $iaddr, $paddr, $proto, $line, $ret);
$remote = shift || @_[0];
$port = shift || @_[1];
@_ = "";
if ($port =~ /\D/){ $port = getservbyname($port, 'tcp') }
die "No such port" unless $port;
$iaddr = inet_aton($remote) or die "Unable to contact remote host: $remote";
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "Socket connection error: $!";
$ret = (connect(SOCK, $paddr));
close (SOCK) or die "Socket close error: $!";
return $ret;
}
###############################################################################
#Main stuff
###############################################################################
$query = new CGI;
$host = $query->param('host'); #accept "host" as hostname input parameter
$port = $query->param('port'); #accept "port" as portnum input parameter
if (checkPort($host, $port)){
print $up;
}else{
print $down;
}
This is the included readme:
Port Ping - a Shard Commander utility
-------------------------------------
Copyright 1999 Anarchy inK
Installation:
1) Copy up.gif and down.gif into the web root on your web server.
2) Change the first line of portping.cgi using notepad or another text editor
to the path of your perl interpreter.
3) Copy portping.cgi into the cgi-bin on your web server.
4) Add the following line of HTML to a page on your web server:
<img src="/cgi-bin/portping.cgi?host=your_ip&port=2593" border=0>
where your_ip = the ip address of your shard
5) Be sure to add our copyright to your page. It is part of the license agreement.
<A HREF="http://www.anarchyink.com/sc">Shard Commander</A> is
©1999 <A HREF="http://www.anarchyink.com" TARGET="_top">Anarchy
inK</A> · All Rights Reserved.
6) Go to the page and test it.
If anyone can do this, great and many thanks, if not .. well .. in some few months I might just figure out how