Jump to content

detecting internet connection


Recommended Posts

my script crashes when inetget is used and there is no internet connection.

i tried a workaround, but it didnt work.

Select
        
        Case $msg = $button1
            call("update")

the function was the workaround. i didnt have it go to a function before i started experimenting

with detecting an internet connection.

because if there was no connection it should return. here is the part of the function that i tried to check with.

InetGet($remoteFile1, $localFile1, 1)
            $noconnect = @InetGetActive
            If $noconnect = -1 Then
                MsgBox(0,"Not connected!","The internet is not connected!")
                Return
            EndIf

because it crashes when trying to get the file and there is no internet connection. i looked in the help file for another way to determine internet connection, like before i call inetget but could not find any.

any suggestions?

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to post
Share on other sites

i syour script crashing or just not doing anything?

have you waited a while for it to continue

you can check the connection via inetget if you want

$a = inetget($remoteFile1, $localFile1, 1)
if $a = 0 then
MsgBox(0,"Not connected!","The internet is not connected!")
Return
EndIf

hope this helps you

Link to post
Share on other sites

my script crashes when inetget is used and there is no internet connection.

i tried a workaround, but it didnt work.

Select
        
        Case $msg = $button1
            call("update")

the function was the workaround. i didnt have it go to a function before i started experimenting

with detecting an internet connection.

because if there was no connection it should return. here is the part of the function that i tried to check with.

InetGet($remoteFile1, $localFile1, 1)
            $noconnect = @InetGetActive
            If $noconnect = -1 Then
                MsgBox(0,"Not connected!","The internet is not connected!")
                Return
            EndIf

because it crashes when trying to get the file and there is no internet connection. i looked in the help file for another way to determine internet connection, like before i call inetget but could not find any.

any suggestions?

Why not just try a simple ping of the host your trying to get the file from?

$var = Ping("www.AutoItScript.com",250)

If $var Then; also possible: If @error = 0 Then ...

Msgbox(0,"Status","Online, roundtrip was:" & $var)

Else

Msgbox(0,"Status","An error occured with number: " & @error)

EndIf

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to post
Share on other sites

@ first reply

it just does nothing. then i try to close it and windows tells me the program is not responding.

thanks that worked though.

@second reply

im not checking with the file... im already planning on having the file download. i just wanted to check the connection so when i get the file it doesnt crash and i can make it return instead.

@third reply

see @second reply

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to post
Share on other sites

@second reply

im not checking with the file... im already planning on having the file download. i just wanted to check the connection so when i get the file it doesnt crash and i can make it return instead.

Ok. I understand. Your INetGet() shouldn't crash. On failure, it should just return 0. Maybe you can test connectivity with Ping() and then run your INetGet() as a workaround like this:

$pingtest = Ping($remoteLocation)

If $pingtest <> 0 Then
    InetGet($remoteFile1, $localFile1, 1)
Else
    MsgBox(0,"Not connected!","The internet is not connected!")
EndIf
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...