CFLib.org – Common Function Library Project

GetServerIP()

Last updated January 12, 2004
Download UDF

author

Robert Everland III                               Robert Everland III

Version: 1 | Requires: ColdFusion 5 | Library: UtilityLib

 
Rated 2 time(s). Average Rating: 4.0

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:

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

Search CFLib.org


Latest Additions

Shawn Porter Shawn Porter added
DeMoronize
3 hour(s) ago

Chris Carey Chris Carey added
readPropertiesFi...
1 day(s) ago

Randy Johnson Randy Johnson added
lastDayofWeek
3 day(s) ago

Frank Marion Frank Marion added
sitemapPing
7 day(s) ago

Top Rated

James Sleeman                                     QuickSort
Rated 5.0, 3 time(s)

Barney Boisvert indentXml
Rated 5.0, 3 time(s)

Nathan Dintenfass                                 queryColumnsToSt...
Rated 5.0, 3 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 3 time(s)

Created by Raymond Camden / Design by Justin Johnson