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();
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson