Ping(host)
Last updated October 14, 2008
Version: 1 | Requires: ColdFusion 8 | Library: NetLib
Description:
Sometime you would like to ping URLs to check their availability just like using windows run command ping <ip/url>
Return Values:
A string containing the results of the ping.
Example:
<cfoutput>
Almontel 1: #Ping("www.almontel1.com")#<br>
Almontel 2: #Ping("www.almontel2.com")#<br>
</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| host | URL/IP that you would like to ping. | Yes |
Full UDF Source:
<!---
Pings a website using .net framework
@param host URL/IP that you would like to ping. (Required)
@return A string containing the results of the ping.
@author Elias (eliasjp@msn.com)
@version 1, October 14, 2008
--->
<cffunction name="Ping" returntype="string" output="false" access="public">
<cfargument name="host" type="string" required="yes">
<!--- Local vars --->
<cfset var pingClass="">
<cfset var pingReply="">
<!--- Get Ping class --->
<cfobject type=".NET" name="pingClass"
class="System.Net.NetworkInformation.Ping">
<!--- Perform synchronous ping (using defaults) --->
<cfset pingReply=pingClass.Send(Arguments.host)>
<!--- Return result --->
<cfreturn pingReply.Get_Status().ToString()>
</cffunction>
Search CFLib.org
Latest Additions
Tayo Akinmade added
arrayTrim
4 day(s) ago
Will Belden added
longTime
9 day(s) ago
James Sleeman added
quickSort
19 day(s) ago
Ben Forta added
GetHostAddress
22 day(s) ago
Top Rated
EksporSQLData
Rated 5.0, 16 time(s)
backupDatabase
Rated 5.0, 13 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)