Sign in to follow this  
Followers 0
Azazel

InetGet timeout

27 posts in this topic

#1 ·  Posted (edited)

Hi, and thx for your great Job.

I know that this post is not really at the good place.

But i have write a script that now is use by few persons.

A bug continue to exist when a webpage don't answer.

The script stay block and i can't stop it without CRTL+ALT+SUPP

I have give "backround" parameter for the InetGet instruction.

That's work perfectly is the page don't exist but block if the page don't answer.

I don't want to make a second .exe too, for control of the download.

I supply you to insert a timeout parameter for the InetGet if it's possible and not too complex

Thank's very mutch

Best Regards

Aza

Edited by Azazel

Share this post


Link to post
Share on other sites



Hi, and thx for your great Job.

I know that this post is not really at the good place.

But i have write a script that now is use by few persons.

A bug continue to exist when a webpage don't answer.

The script stay block and i can't stop it without CRTL+ALT+SUPP

I have give "backround" parameter for the InetGet instruction.

That's work perfectly is the page don't exist but block if the page don't answer.

I don't want to make a second .exe too, for control of the download.

I supply you to insert a timeout parameter for the InetGet if it's possible and not too complex

Thank's very mutch

Best Regards

Aza

<{POST_SNAPBACK}>

did you see the background parameter and the @InetGetBytesRead , @InetGetActive macros? :idiot:

Share this post


Link to post
Share on other sites

Yes JPM, i have seen and use this parameters, and as you can see in my post i have use the backround parameter too.

You have already answer me for a long date before, see your message and your conclusion

http://www.autoitscript.com/forum/index.ph...5131&hl=inetget

:">

<{POST_SNAPBACK}>

if your expectation is to have several download it is not possible due to the implementation. see doc

Note, only one download can be active at once, if you call the function again before a download is complete it will fail.

:idiot:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

if your expectation is to have several download it is not possible due to the implementation. see doc

:idiot:

<{POST_SNAPBACK}>

No jpm, i don't want several download in the same time, but one and another.

The problem is not here, i'll try to explain in another way :

Case with only one InetGet instruction in a script

You run Mozilla or IE with an URL.

In case of the page you're asking for Exist but not responding, the brower give you a message after a few seconds

Now you do the same thing with InetGet instruction with all parameter you want :

The script block on the line InetGet and wait... with no possibility to stop it without CTRL+ALT+SUPP

And here is my problem...

Also, as the script is blocking, you have non possibility of tests with timer or else.

However if the page not exist at all, no problem with the sript

I hope you understant better now the problem

Thx again

Aza

Edited by Azazel

Share this post


Link to post
Share on other sites

No jpm, i don't want several download in the same time, but one and another.

The problem is not here, i'll try to explain in another way :

Case with only one InetGet instruction in a script

You run Mozilla or IE with an URL.

In case of the page you're asking for Exist but not responding, the brower give you a message after a few seconds

Now you do the same thing with InetGet instruction with all parameter you want :

The script block on the line InetGet and wait... with no possibility to stop it without CTRL+ALT+SUPP

And here is my problem...

Also, as the script is blocking, you have non possibility of tests with timer or else.

However if the page not exist at all, no problem with the sript

I hope you understant better now the problem

Thx again

Aza

<{POST_SNAPBACK}>

You can use background=1 and have some logic in an Adlib functions testing @InetGetBytesRead.

I don't know if after failure the @InetGetActive should be 0.

Perhaps JON when it is back can answer this 0 setting or not. :idiot:

Share this post


Link to post
Share on other sites

You can use background=1 and have some logic in an Adlib functions testing @InetGetBytesRead.

I don't know if after failure the @InetGetActive  should be 0.

Perhaps JON when it is back can answer this 0 setting or not. :idiot:

<{POST_SNAPBACK}>

background is already to 1 :">

Share this post


Link to post
Share on other sites

background is already to 1  :">

<{POST_SNAPBACK}>

put a sample of your script so I can help you :idiot:

Share this post


Link to post
Share on other sites

This is an exemple of braking url, i have modify a little my script for running alone

#include <GUIConstants.au3>

$erreur=0

$ReadAll=""

$temp="Temp.html"

$connect=InetGet ("http://tx2.us.unitedadmins.com/cdeath-dl.php",$Temp,1,1)

$begin = TimerInit()

While @InetGetActive

$dif = TimerDiff($begin)

if $dif>10000 then

MsgBox(0,"Error","Error")

$erreur=1 

  ExitLoop

EndIf 

Wend

if $erreur<>1 And @InetGetBytesRead<>-1 then

$abc = FileReadAll ($Temp)

Do

FileDelete ($Temp)

until FileExists($temp)=0

EndIf

Func FileReadAll($File)

    $OpenFile = FileOpen($File, 0)

if $OpenFile = -1 then

MsgBox(0, "Error", "Unable to open file.") 

exit

endif

    $ReadAll = FileRead($OpenFile, FileGetSize($File))

if $ReadAll = -1 then

MsgBox(0, "Error", "Error occur")

GUIDelete ( )

exit

endif

FileClose($OpenFile)

    Return $ReadAll

EndFunc

MsgBox(4096,'debug:' , '$ReadAll:' & $ReadAll) ;### Debug MSGBOX

Thx

Share this post


Link to post
Share on other sites

This is an exemple of braking url, i have modify a little my script for running alone

Thx

<{POST_SNAPBACK}>

does that work for you?

$temp="Temp.html"

$connect=InetGet ("http://tx2.us.unitedadmins.com/cdeath-dl.php",$Temp,1,1)

$inactive=0

$lastread=-1

AdlibEnable("checkInetGetActive", 10000)

while @InetGetActive

  sleep(500)

  if $inactive = 1 then

      msgbox(4096,"Download", "no Byte received")

      Exit

  EndIf

WEnd

MsgBox(4096,'debug:' , '@InetGetBytesRead:' & @InetGetBytesRead) ;### Debug MSGBOX

FileDelete ($Temp)

if FileExists($temp) then msgbox(4096,"delete","too fast")  ; should not be needed

exit

Func checkInetGetActive()

  if $lastread = @InetGetBytesRead then $inactive=1

  $lastread = @InetGetBytesRead

EndFunc 

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

does that work for you?

<{POST_SNAPBACK}>

Thx jpm but now test this :

Put an not existing URL like "http://www.test.com", in your own script

and change the value : AdlibEnable("checkInetGetActive", 2000)

You can see that nothing appears after 2 secondes :idiot:

After a moment you'll have the message @InetGetBytesRead=-1 because the URL don't exist

Howerver, if it was existing but not responding, the script would stay waiting... :D

Ah bah j'avais pas vu que tu étais français, ca serait plus facile :lol:

Je suis des Yvelines

Edited by Azazel

Share this post


Link to post
Share on other sites

Thx jpm but now test this :

Put an not existing URL like "http://www.test.com", in your own script

and change the value : AdlibEnable("checkInetGetActive", 2000)

You can see that nothing appears after 2 secondes  :D

After a moment you'll have the message @InetGetBytesRead=-1 because the URL don't exist

Howerver, if it was existing but not responding, the script would stay waiting...  :lol:

Ah bah j'avais pas vu que tu étais français, ca serait plus facile  :D

Je suis des Yvelines

<{POST_SNAPBACK}>

My script is not perfect. I just try to illustrate the adlib mechanism. The logic must be improved to your expectation.

right now my script just prove that nothing change in 10sec. Changing just 10sec to 2sec is not enought to prove that there is an activity or not. You need to have an adlib sampling of 500 and to count how much time you get the same value to decide.

I hope you can improve the script ;)

A votre service :idiot:

Share this post


Link to post
Share on other sites

I am going to be crasy :idiot:

jpm see and try that

#include <GUIConstants.au3>

$temp="Temp.html"

AdlibEnable("checkInetGetActive", 2000)

$connect=InetGet ("http://www.test.com",$Temp,1,1)

Func checkInetGetActive()

exit

EndFunc 

InetGet block also the Adlib function :D

Share this post


Link to post
Share on other sites

That shouldn't be happening and I agree that there has to be a timeout parameter.

Share this post


Link to post
Share on other sites

I am going to be crasy  :idiot:

jpm see and try that

InetGet block also the Adlib function  :D

<{POST_SNAPBACK}>

Your script just prove that the inetget have terminate before the 2 seconds.

try the foillowing you will see and adlib msgbox before the end message box.

#include <GUIConstants.au3>
$temp="Temp.html"
AdlibEnable("checkInetGetActive", 500)
$connect=InetGet ("http://www.test.com",$Temp,1,1)

msgbox(4096,"return from Inetget",$connect)

Func checkInetGetActive()
msgbox(4096,"adlib","")
EndFunc

Share this post


Link to post
Share on other sites

Thx for help jpm, i'll work around your last script to update mine.

However i'm sure that a timeout parameter would be more efficient and easy to use :idiot:

Share this post


Link to post
Share on other sites

Thx for help jpm, i'll work around your last script to update mine.

However i'm sure that a timeout parameter would be more efficient and easy to use  :idiot:

<{POST_SNAPBACK}>

Glad you canwork with current implementation. :D

I leave to JON the final answer about timeout

Share this post


Link to post
Share on other sites

Hi jpm, this morning the url "http://tx2.us.unitedadmins.com/cdeath-dl.php", was block again :idiot:

So i have test your scripts, with different value of Adlib, nothing work :D

Your script stay block indefinitely :lol:

Share this post


Link to post
Share on other sites

Hi jpm, this morning the url "http://tx2.us.unitedadmins.com/cdeath-dl.php", was block again :idiot:

So i have test your scripts, with different value of Adlib, nothing work  :lol:

Your script stay block indefinitely  ;)

<{POST_SNAPBACK}>

I don't know what to say because this working ypur url is working again :D

Share this post


Link to post
Share on other sites

I don't know what to say because this working ypur url is working again :idiot:

<{POST_SNAPBACK}>

I know jpm, that's the problem with this URL, sometime it's block for few minutes/hours, sometime it's normaly.

In case of blocking again, i hope i would be able to contact you...

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