For downloading a number of images I'm making DownloadDataAsync calls to separate instances of WebClient, in a loop, with a thread sleep delay. I expected the response to happen on separate threads, but it seems not, as response only occurs after all calls are completed.
So what's an appropritate fix for this? Is there an alternative client type, or should I make a thread for each webclient call?
So currently I'm calling this in a loop:
Private Sub StartDownload(ByVal webImageLink As String, ByVal token As Object)
Dim wc As New WebClient
Try
AddHandler wc.DownloadDataCompleted, AddressOf OnDownloadCompleted
wc.DownloadDataAsync(New System.Uri(webImageLink), token)
Threading.Thread.Sleep(delay)
Catch ex As Exception
Debug.Print("Exception in ImageDownloader.DoDownload ")
End Try
End Sub