How did I know when a File is downloaded on HTTPSecureSocket

I have links stored in a Array

In order to do a download queue, First I download only the first item on the list, then On the “DownloadComplete” HTTPSecureSocket’s Event I download the next file in the array, until reach the total of items in the array, something like this:

  if NumFileDownloaded < Links.Ubound Then
    DownloadedLinks = False
    NumFileDownloaded = NumFileDownloaded + 1
    CookieJar                        ///EXPERIMENTAL---- OBTIENE COOKIE
    SetupDownloadSocket 
    DownloadXMLTEMP = SpecialFolder.Desktop.Child("NewCFDIS").Child(Cstr(NumFileDownloaded)+".xml")
    Downloader.Get(Links(NumFileDownloaded), DownloadXMLTEMP) 
    
    
    
    DownloadStatus = "Downloading: " + Cstr(NumFileDownloaded) + " of " + Cstr(Links.Ubound) + EndOfLine +Str(httpstatus)
    
  else
   DownloadedLinks = True
  End If

And doing this way I can download successfully all the Links, I think its better use the Asynchronous download rather the Synchronous mode.
Cuz everytime when I downloaded files Synchronous mode in the past, Some links was downloaded, another some isnt being downloaded.

So, What I have doubt is where do I know when the download file are successfully, in order to process it, like adding text or replace text to the recently downloaded file.

When I used Synchronous mode, I was doing something like this:

If HTTPSecureSocket.Get(Link,FolderItem,TimeOut) Then
Msgbox "File successfully downloaded"
End If

But I can’t do that on Asynchronous mode, What Am I Doing wrong?

Thanks in advance

Look at the DownloadComplete event.

In fact, Thats right I previously used the “file” attribute of the DownloadComplete event. The issue here is my fault, cuz the Method that I use to parse the Document was wrong and Ergo, there’s no output file or a blank file.

So I made again my method and voila!!, It works.