Jump to content

Recommended Posts

Posted

Buy one (but not here) or try to write your own. But note: not every webserver answers on a ping.
For starting have a look in helpfile about:

Quote

Ping

Pings a host and returns the roundtrip-time.

 

Posted
11 hours ago, AutoBert said:

Buy one (but not here) or try to write your own. But note: not every webserver answers on a ping.
For starting have a look in helpfile about:

 

I started with example script but can only get return value of 0 = failure.

How to return value @error (e.g Host is offline)

Posted
Quote

Return Value

Success: the roundtrip-time in milliseconds ( greater than 0 ).
Failure: 0 if host is not pingable or other network errors occurred and sets the @error flag to non-zero.
@error: 1 = Host is offline
2 = Host is unreachable
3 = Bad destination
4 = Other errors
Local $iPing = Ping("192.168.22.1", "250")

Switch (@Error)
    Case 1
        MsgBox("", "", "Host is offline.")  ; I hope it's not, then you have no internet!
    Case 2
        MsgBox("", "", "Host is unreacable.")
    Case 3
        MsgBox("", "", "Bad destination.")
    Case 4
        MsgBox("", "", "Other errors.")
    Case Else
        MsgBox($MB_SYSTEMMODAL, "", "The roundtrip-time took: " & $iPing & "ms.")
EndSwitch

 

Posted
1 hour ago, InunoTaishou said:
Local $iPing = Ping("192.168.22.1", "250")

Switch (@Error)
    Case 1
        MsgBox("", "", "Host is offline.")  ; I hope it's not, then you have no internet!
    Case 2
        MsgBox("", "", "Host is unreacable.")
    Case 3
        MsgBox("", "", "Bad destination.")
    Case 4
        MsgBox("", "", "Other errors.")
    Case Else
        MsgBox($MB_SYSTEMMODAL, "", "The roundtrip-time took: " & $iPing & "ms.")
EndSwitch

 

Hey thanks, this is what I need.

But autoit ping return "Host is unreachable" while I don't have internet connection and windows ping show "request timed out" :(

Since I need this to reconnect wifi (fyi: sometimes my wifi status connected but can't reach internet, but by reconnecting I'm able to reach internet again)

Is there anyway around to accomplish this ?screenshot_00036.thumb.png.fd7a4576f5976

 

Posted

You're pinging your router and getting host unreachable (same thing as timed out, means windows tried to send data to the ip but didn't get a reply within the time limit). Sounds like you need to disconnect then reconnect. I usually disable my adapter then re-enable it. I'm sure there's a UDF floating around on the forum somewhere for reconnecting to wifi or disable/enable your network adapter.

Posted
24 minutes ago, InunoTaishou said:
24 minutes ago, InunoTaishou said:

You're pinging your router and getting host unreachable (same thing as timed out, means windows tried to send data to the ip but didn't get a reply within the time limit). Sounds like you need to disconnect then reconnect. I usually disable my adapter then re-enable it. I'm sure there's a UDF floating around on the forum somewhere for reconnecting to wifi or disable/enable your network adapter.

You're pinging your router and getting host unreachable (same thing as timed out, means windows tried to send data to the ip but didn't get a reply within the time limit). Sounds like you need to disconnect then reconnect. I usually disable my adapter then re-enable it. I'm sure there's a UDF floating around on the forum somewhere for reconnecting to wifi or disable/enable your network adapter.

Ok, now I get it, I use windows cmd or batch to reconnect the network adapter.

Thank you for the code, really appreciate that.

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
  • Recently Browsing   0 members

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