MYIP.EXE

  MYIP is a simple TCP/IP utility for querying the current system's IP address 
  **as seen by the outside world**.  This may or may not be the same as the 
  locally-configured IP address, depending on how the system is connected to 
  the Internet.

  When run, MYIP contacts a special website which provides an 'IP echo' 
  service: this service reports the IP address of your computer as the remote 
  server sees it.  This allows you to determine your public IP address even if 
  you are connecting through a firewall or router that uses port-level network 
  address translation (also known as IP masquerading or IP address sharing).

  Obviously, this requires that an IP echo website actually be available.  The
  default configuration file provided (MYIP.CFG) contains two which seem to 
  work reasonably well.

  MYIP requires a 32-bit TCP/IP stack: in other words, MPTS v5.3 (WR*8600) or 
  higher.


INSTALLATION

  Copy MYIP.CFG to the directory indicated by the environment variable 'ETC' 
  (e.g. C:\MPTN\ETC).  You may edit this file to modify the list of available
  echo sites if you wish; the format is documented below.

  Place MYIP.EXE somewhere in the PATH.


USAGE

  To use the program normally, simply run MYIP.EXE with no parameters.  The
  program will attempt to contact the first site defined in MYIP.CFG and use
  it to query your IP address.  If one site fails, MYIP will try the next site 
  listed, up to a maximum of three sites.

  MYIP accepts any one of three optional arguments:

  /?   Display a brief help message.
  /V   Use verbose output.
  /VV  Use very verbose output (mainly useful for diagnostics).


HOW IT WORKS

  MYIP works by simply opening an HTTP connection to the designated server,
  using the URL and port indicated, and attempting to parse the IP address from
  a designated point in the returned data.  Therefore, the site in question 
  must be designed to return the correct IP address in the expected format.

  MYIP will read a maximum of 4 kilobytes (4096 bytes) from the returned data;
  this is an intentional limitation implemented for safety reasons.


CONFIGURATION FILE FORMAT

  Each non-comment, non-blank line in MYIP.CFG defines a single website.  
  Leading and trailing whitespace is ignored.  The format of each entry is:

  <server> <port> <path> <text>

  Where: 
    <server> is the hostname or IP address of the server
    <port>   is the IP port (normally 80) to connect on 
    <path>   is the path to the site on the server which provides the IP echo
             service
    <text>   is the text within the returned data, following which MYIP will
             attempt to parse the IP address

  MYIP will only make use of the first three servers that it successfully 
  parses from this file.  Blank lines, as well as those starting with ';' or 
  '#', are ignored.


COMPILING

  I have successfully built MYIP with three different OS/2 C compilers:
    * A simple batch file (BUILD.CMD) is provided for building with IBM 
      VisualAge C++ (version 3.0 or 3.6.5).
    * Compiling with Innotek GCC is as simple as running 'gcc myip.c'.
    * Compiling with OpenWatcom is similarly easy: 'wcl386 myip.c'.

  The prebuilt executable was compiled using IBM VisualAge and then compressed
  with lxlite.


NOTICES

  MYIP is (C) 2006 Alex Taylor.  

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

  MYIP was inspired by the REXX program "GetMyIP" by Peter Lersen, from which
  much of the logic was obtained.

-- 
Alex Taylor
http://www.cs-club.org/~alex