Hello
I am coding an FTP program, the downloading/uploading happens in a seperate thread. The problem is now how to pause/resume the download (even on servers that don't support file resume), an easy/working way is to pause/resume the working thread with thread.suspend but it tells me that this function is obsolete.
Is there a simmilar method to achieve this? I've tried looking up Mutexes, Monitor, Event, Semaphore stuff but that would only allow me to pause the file transfer after the file is done.
So the code that 'lives' in the thread that I want to suspend looks something like
Private Sub StartUpload(ByVal allFiles As Hashtable)
For Each singleFile As String In allFiles.Keys
Try
ftpClient.UploadFile(singleFile, allFiles.Item(singleFile), False)
Catch ex As Exception
ftpClient.DeleteFile(allFiles.Item(singleFile))
Exit For
End Try
Next
allFiles = Nothing
End Sub
Function get called as following:
UploadThread = New Threading.Thread(AddressOf StartUpload)
UploadThread.Start(allFiles)
So UploadThread.suspend() / resume works perfectly, but I can't really release this if these functions get removed in future releases of .net
Any help is appreciated
GeekByChoiCe