CFLib.org – Common Function Library Project

GetServerIP()

Last updated January 12, 2004

author

Robert Everland III

Version: 1 | Requires: CF5 | Library: UtilityLib

Description:
This tag is able to get the ip address of your server. This can be used for servers that are in a cluster and you need to know the ipaddress of the computer throwing an error. This will only work for one ip of a machine.

Return Values:
Returns a string.

Example:

<cfoutput>#GetServerIP()#</cfoutput>

Parameters:

No arguments.

Full UDF Source:

/**
 * Gets the ip address of the server.
 * 
 * @return Returns a string. 
 * @author Robert Everland III (reverland@reactivevision.com) 
 * @version 1, January 12, 2004 
 */
function GetServerIP() {
   var iaclass="";
   var addr="";
      
   // Init class
   iaclass=CreateObject("java", "java.net.InetAddress");

   //Get Local host variable
   addr=iaclass.getLocalHost();

   // Return ip address
   return addr.getHostAddress();
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson