Modify

Opened 10 years ago

Closed 10 years ago

#1080 closed Feature Request (Completed)

InetGet doesn't return immediately for a background download

Reported by: bjashepherd@… Owned by: Valik
Milestone: 3.3.1.2 Component: AutoIt
Version: Severity: Blocking
Keywords: Cc:

Description

I have some code that loops through and downloads a series of images. It's nice to see that we can download several files simultaneously in the background in the beta now. However, I'm not sure it's working.

Dim $dlHandle[11]
$baseURL = 'http://flickrslideshow.fateback.com/temp/a ('

$folder = @TempDir & '\au3temp\'
DirCreate ($folder)
For $i = 0 To 10
	$fileName = $folder & $i & '.jpg'
	$timer = TimerInit ()
	$dlHandle[$i] = InetGet ($baseURL & $i & ').jpg', _
		$fileName, 1, 1)
	ConsoleWrite(TimerDiff ($timer) & @CRLF)
Next

For $i = 0 To 10
	While Not InetGetInfo ($dlHandle[$i], 2) ;complete?
		Sleep (100)
	WEnd
	InetClose ($dlHandle[$i])
Next

Setting the fourth arg of InetGet to 1 should mean it downloads in the background and returns immediately. However, it takes roughly half a second in each case in this script - about the same amount of time taken to download the entire file. When there are a lot of files, this starts to take up a lot of time.

ben

Attachments (0)

Change History (7)

comment:1 Changed 10 years ago by Valik

  • Type changed from Bug to Feature Request
  • Version 3.3.1.1 deleted

This is not a bug. It's working as written and as intended. However, I am going to change this to a feature request because I do intend to change the behavior.

comment:2 follow-up: Changed 10 years ago by bjashepherd@…

Well, I would argue that it isn't working as written. According to the documentation, the function returns immediately if you set background = 1. For the small files I tested it on, it waits half a second before returning. Is it downloading in the foreground for small files? It would be good to mention this in the documentation if this is the case.

Thanks for your time - I do appreciate you've got a lot of other things to work on.

ben

comment:3 in reply to: ↑ 2 Changed 10 years ago by Valik

Replying to bjashepherd@…:

Well, I would argue that it isn't working as written.

Um, excuse me, did you write the function? No, you didn't, I did. It's working as written. The download happens in the background. The connection to the server is established in the foreground. The code is written that way, the code was intentionally written that way. Irrelevant of what the documentation says.

Anyway, it's a moot point. As I mentioned, I intend to change it.

comment:4 Changed 10 years ago by bjashepherd@…

No need to be rude. The point I was trying to make is that the Help file says that the function returns immediately if you set background=1. That's not my experience. (The help doesn't mention anything about 'establishing a connection', I thought it was probably something like that though.) I thought by "as written" you meant "as written in the documentation". No arrogance intended on my part - sorry if it came across badly. Like I say, I appreciate that you're busy and I do think that you're doing a fantastic job on AutoIt.

ben

comment:5 Changed 10 years ago by Jpm

  • Owner set to Valik
  • Status changed from new to assigned

comment:6 Changed 10 years ago by Valik

  • Severity changed from None to Blocking

Set as blocking, it needs done before the next beta.

comment:7 Changed 10 years ago by Valik

  • Milestone set to 3.3.1.2
  • Resolution set to Completed
  • Status changed from assigned to closed

Changed in version: 3.3.1.2

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Valik.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.