Sign in to follow this  
Followers 0
sambalec

How to detect with a command if internet is connected ...( internet connexion ok )

5 posts in this topic

Hi ! :D

How to detect with a autoit command if internet is connected or not connected ?

Thank's a lot

Share this post


Link to post
Share on other sites



take this might do you some good...

while 1
$nSize = InetGetSize("http://www.autoitscript.com/autoit3/files/beta/update.dat")
    sleep(5000)
if $nSize = 0 then ToolTip("No Connection", 0, 0)
if $nSize <> 0 then ToolTip("Connection Established", 0, 0)
    wend

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

another way...

$ping = Ping("google.com", 500)
        If $ping > 0 Then
        MsgBox(0, "", CONNECTED)
        EndIf
Edited by Shark007

Share this post


Link to post
Share on other sites

Thank's a lot my friends

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

This is what I'd use:

#include <INet.au3>
Global sPublicIP
HttpSetProxy(0)
;
; get WAN IP of user
Do
    $sPublicIP = GetWANIP() ; get WAN IP
Until $sPublicIP <> -1
;
Func GetWANIP()
    $sPublicIP = _GetIP() ; check WAN IP
    If @error Then
        Local $iBtnID = MsgBox("262197","ERROR","CAN'T GET WAN IP" & @CRLF & "Possible cause: Blocked by Firewall, Sandbox or insufficient bandwidth.")
        If $iBtnID = 2 Then Exit ; Cancel pressed
        If $iBtnID = 4 Then Return ($sPublicIP) ; Retry pressed (goes back to calling loop and returns again)
    EndIf
    Return ($sPublicIP)
EndFunc   ;==>GetWANIP

Edit: forgot to add the include.

Edited by PartyPooper

Share this post


Link to post
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
Sign in to follow this  
Followers 0