Sign in to follow this  
Followers 0
neilontherock

Why does InetClose always returns false?

5 posts in this topic

Why does InetClose always returns false?

example code:

Local $hDownload = InetGet($oLink.href, $Downloadfile,1,1)

Do

Sleep(250)

Until InetGetInfo($hDownload, 2) ; Check if the download is complete.

Local $InetCloseResult = InetClose($hDownload)

;InetCloseResult this always returns False but would of expected True but perhaps this function is just a safety check

Share this post


Link to post
Share on other sites



This might be an issue of documentation. Your loop doesn't end until the transfer is complete, and I believe the handle may have been closed automatically at that time, so trying to re-close it fails. The help file does explicitly say to close the handle, but in the case of background download, maybe that doesn't apply after normal end of the transfer. You would still close the handle to cancel a transfer.

;)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This might be an issue of documentation. Your loop doesn't end until the transfer is complete, and I believe the handle may have been closed automatically at that time, so trying to re-close it fails. The help file does explicitly say to close the handle, but in the case of background download, maybe that doesn't apply after normal end of the transfer. You would still close the handle to cancel a transfer.

;)

Thanks for the reply.

I have another question, not sure if you can help but here's my problem. I have a script that runs, does an INetGet and it works fine for about 20 minutes and then seems to fail or at least no bytes are received. When InetGet starts failing it seems to fail more and more frequently and a call to InetGetInfo returns the following information;

08/31/2010 15:32:59 Script Started - Log File Created

...example of running ok

08/31/2010 15:51:30 Attempting InetGet

08/31/2010 15:51:31 InetGet time: 1028.97547034609

08/31/2010 15:51:31 Bytes read: 48018, Size: 48018, Process: True, Result: True, ErrorValue: 0, ExtendedValue: 0

08/31/2010 15:51:31 Total Bytes read: 25908852

...runs fine for about 20 minutes then the following;

08/31/2010 15:51:31 Attempting InetGet

08/31/2010 15:56:32 InetGet time: 300231.559877023

08/31/2010 15:56:32 Bytes read: 0, Size: 0, Process: True, Result: False, ErrorValue: 13, ExtendedValue: 12002

08/31/2010 15:56:32 Total Bytes read: 25908852

08/31/2010 15:56:35 Attempting InetGet

08/31/2010 16:01:35 InetGet time: 300121.175456657

08/31/2010 16:01:35 Bytes read: 0, Size: 0, Process: True, Result: False, ErrorValue: 13, ExtendedValue: 12002

08/31/2010 16:01:35 Total Bytes read: 25908852

Edited by neilontherock

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Is your script just downloading the same file over and over? Does the target site have limitations or intrusion detection that might block that after a while? Come up with a list of five or six different target files and loop through them one at a time to see if still dies. Or just inquire of the webmaster for the site.

;)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Is your script just downloading the same file over and over? Does the target site have limitations or intrusion detection that might block that after a while? Come up with a list of five or six different target files and loop through them one at a time to see if still dies. Or just inquire of the webmaster for the site.

;)

No my script is downloading a different file each time. One thing I noticed is that Virtual Memory for my process is really high (about 1.5g) when the INetGet starts returning 0 bytes. I added code to clean up the IE cache folders after I process each page. That did seem to help a little but about 1/2 way through my script the Virtual memory just keeps increasing again. I did verify that the cache files are getting deleted. I also used process manager to see if any other files were being cached. Weird, can't figure out my the Virtual Memory gets so high but it does seem to be the root cause of why the INetGet starts returning 0 bytes. Oh well, keep plugging away! :-)

Edited by neilontherock

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