Jump to content

Ping: gathering the extended info


Recommended Posts

hey, i was using the Ping function and im a little unsure of how to get the extended info with @error... could someone give me an example of how to do this?

From helpfile:

When the function fails (returns 0) @error contains extended information:

1 = Host is offline

2 = Host is unreachable

3 = Bad destination

4 = Other errors

id like to know how to do that.. thanks! :lmao:o:)

Edited by layer
FootbaG
Link to comment
Share on other sites

Some examples for you:

$result = Ping("www.hiddensoft.com",250)
If $result = 1 Then MsgBox(0, 'Error', 'host is not pingable or other network errors occured and sets @error')
If $result = 0 Then MsgBox(0, 'Success', 'Returned the roundtrip-time in milliseconds: ' & $result)
If @error = 1 Then MsgBox(0, 'Error', 'Host is offline')
If @error = 2 Then MsgBox(0, 'Error', 'Host is unreachable')
If @error = 3 Then MsgBox(0, 'Error', 'Bad destination')
If @error = 4 Then MsgBox(0, 'Error', 'Other errors')
If @error Then MsgBox(0, 'Error', 'Unknown error')
If Not @error Then MsgBox(0, 'Success', 'Host has been pinged')

Just pick 1, or 2 or.... :lmao:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...