Script

Show Script

Showing code for: lookup.irev

Back

<?rev
   -- Standard header -------------------------------
   put "Troz : : On-Rev" into tHeader
   include "../../includes/header.irev"
   
   include "../../includes/menu.irev"
   --------------------------------------------------
?>

<?rev

function useLookup pName
   put shell("nslookup" && pName) into tLookup
   if tLookup contains "Address" then
      put last word of tLookup into tIP
   else
      put "0.0.0.0" into tIP
   end if

   return tIP
end useLookup


function useHost pName
   put shell("host" && pName) into tLookup
   if tLookup contains "address" then
      put last word of tLookup into tIP
   else
      put "0.0.0.0" into tIP
   end if

   return tIP
end useHost


?>

   <?rev include "includes/scriptlink.irev" ?>
   <h1>Lookup</h1>
   
   This is testing and timing different methods of looking up IP addresses from names. <br />
   Refresh the page to test again, as the first time might have been slower as the page loaded.
   <hr />

   <?rev
   
      put the milliseconds into tStart
      repeat 10 times
         get useLookup("troz.dyndns.org")
      end repeat
      put "<p>Using lookup 10 times took " & the milliseconds - tStart & " milliseconds."

      put the milliseconds into tStart
      repeat 10 times
         get useHost("troz.dyndns.org")
      end repeat
      put "<p>Using host 10 times took " & the milliseconds - tStart & " milliseconds."

      put the milliseconds into tStart
      repeat 10 times
         get hostNameToAddress("troz.dyndns.org")
      end repeat
      put "<p>Using hostNameToAddress 10 times took " & the milliseconds - tStart & " milliseconds."

   ?>


<?rev
   -- Standard footer -------------------------------
   include "includes/showIncludes.irev"
   include "../../includes/footer.irev"
   --------------------------------------------------
?>