The Network Class belongs to Microsoft.VisualBasic.Devices namespace.
The .NET Ping method is overloaded, the return value is always Boolean. ( Conversion Required )
[hide]
String. The URL, computer name, or IP number of the server to ping. Required.
Uri. The URI of the server to ping. Required.
Int32. Time threshold in milliseconds for contacting the destination. Default is 500. Required.
This example reports whether or not the server can be pinged by determining whether the Ping method returns True.
Set network = DotNetFactory.CreateInstance( "Microsoft.VisualBasic.Devices.Network" )
If CBool( network.Ping( "www.advancedqtp.com" ) ) Then
MsgBox( "Server pinged successfully." )
Else
MsgBox( "Ping request timed out." )
End If
This example reports whether or not the server can be pinged by determining whether the Ping method returned True and specifies a timeout interval of 1000 milliseconds.
Set network = DotNetFactory.CreateInstance( "Microsoft.VisualBasic.Devices.Network" )
If CBool( network.Ping( "198.01.01.01", 1000 ) ) Then
MsgBox( "Server pinged successfully." )
Else
MsgBox( "Ping request timed out." )
End If
Also it can be done in only one line
Print DotNetFactory.CreateInstance( "Microsoft.VisualBasic.Devices.Network" ).Ping( "www.advancedqtp.com" ).ToString()
Posted in DotNetFactory

daniva




Recent Comments