I was a little disconcerted when I accessed my abooks.com web page last
night and it welcomed me as coming from "none."<g> Obviously, some IP
numbers do not have names associated with them. So I modified my
modification of wherefrom.r to make more sense, to wit:


#!/rebol/rebol --cgi
REBOL

]
     ip: system/options/cgi/remote-addr
     print "Content-Type: text/plain^/"
     print "<font face='ARIAL' size='-2'>"
     print ["Thank you for visiting this page from<br>IP: "
      ip "- - - Name: " read join dns:// ip]
      print [<br>" on"
       now/date "at" now/time "our time (U.S. Eastern)."
]
     print "<BR><BR></font>"


     which gives the result:

     Thank you for visiting this page from
     IP: 207.205.134.55 - - - Name: pool-207-205-134-55.atln.grid.net
     on 6-Oct-1999 at 11:31:41 our time (U.S. Eastern).


>
> Hey! This is interesting, guys... thanks for the info... and here's my
> addition to the discussion:
>
> If you do:
>
>       ip: system/options/cgi/remote-addr
>
> then add:
>
>       print read join dns:// ip
>
> it will convert 216.122.85.130 to abooks.com.
>
> So then, it becomes easy to modify the wherefrom.r program to
> give the name
> instead of the number, thusly:
>
>
>       #!/rebol/rebol --cgi
>       REBOL
>
>       ]
>       ip: system/options/cgi/remote-addr
>       print "Content-Type: text/plain^/"
>       print "<font face='ARIAL' size='-1'>"
>       print ["Thank you for visiting this page from"
>       read join dns:// ip " on" now/date "at" now/time "our time (U.S.
> Eastern\)."]
>       print "<BR><BR></font>"
>
>
> Throw that script's result at the top of your index.html page and enjoy.
> Check it out in operation at http://abooks.com. The two banners at the top
> are done by banner.r, which I've submitted to the library. This Rebol heah
> is a mighty nice language!
>
> --Ralph
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, October 05, 1999 2:09 PM
> > To: [EMAIL PROTECTED]
> > Subject: [REBOL] ip address? Re:
> >
> >
> > Dennis wrote:
> > > I'm new to Rebol but was wondering if  there is anyway I can use it to
> > > find out the ip address of the machine it's running on. I have been
> > > losing my connection to the internet and when the machine
> reconnects it
> > > gets a new ip address. I would like to use Rebol to then update some
> > > html with this new ip address.
> >
> > Hi Dennis,
> >
> > I fished this out of the archive... It was a discussion we had about
> > two months ago.  It gets a little convoluted, but it does properly
> > change the IP address.  system/network/host-address doesn't change
> > when you get your new IP address, reading dns:// does.
> >
> > [--Insert old posting--]
> > > At 09:46 PM 8/12/99 +0200, you wrote:
> > > >Hi fellow rebols,
> > > >
> > > >does someone know wether it is possible to get the
> > > >hostname/ip-address of the machine rebol is running on?
> > >
> > > >> print system/network/host-address
> > > 127.0.0.1
> > > >> print system/network/host
> > > knobel
> >
> > You can also use the DNS protocol, though going direct to the system
> > object is quicker:
> >
> > To get the hostname:
> > >>print read dns://
> > sarnoff
> >
> > To get the IP address:
> > (This is the same as doing: print read dns://sarnoff)
> > >>print read rejoin [ dns:// read dns:// ]
> > 206.191.108.253
> >
> > To get the FQDN:
> > (This is the same as doing: print read dns://206.191.108.253)
> > >>print read rejoin [dns:// read rejoin [dns:// read dns://] ]
> > sarnoff.insinc.ca
> >
> > Kev
> >
> > ------------------------------------------------------------------------
> > Kevin McKinnon, System Administrator/Chief Engineer        [EMAIL PROTECTED]
> > Interactive Netcasting Systems, Inc.                http://www.insinc.ca
> >
> >       "If God meant man to fly, He'd have given him more money."
> >
> > PGP Public Key: http://www.dockmaster.net/pgp.html   PGP 6.0 www.pgp.com
> >
>

Reply via email to