Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/Multi Transfer


Required plugins for this example: MBS CURL Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /CURL/Multi Transfer

This example is the version from Wed, 3rd Jan 2023.

Project "Multi Transfer.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() multi.Perform End EventHandler
End Control
EventHandler Sub Open() urls = array(_ "http://www.microsoft.com",_ "http://www.opensource.org",_ "http://www.google.com",_ "http://www.yahoo.com",_ "http://www.ibm.com",_ "http://www.mysql.com",_ "http://www.oracle.com",_ "http://www.ripe.net",_ "http://www.iana.org",_ "http://www.amazon.com",_ "http://www.netcraft.com",_ "http://www.heise.de",_ "http://www.chip.de",_ "http://www.ca.com",_ "http://www.cnet.com",_ "http://www.news.com",_ "http://www.cnn.com",_ "http://www.wikipedia.org",_ "http://www.dell.com",_ "http://www.hp.com",_ "http://www.cert.org",_ "http://www.mit.edu",_ "http://www.nist.gov",_ "http://www.ebay.com",_ "http://www.playstation.com",_ "http://www.uefa.com",_ "http://www.ieee.org",_ "http://www.apple.com",_ "http://www.sony.com",_ "http://www.symantec.com",_ "http://www.zdnet.com",_ "http://www.fujitsu.com",_ "http://www.supermicro.com",_ "http://www.hotmail.com",_ "http://www.ecma.com",_ "http://www.bbc.co.uk",_ "http://news.google.com",_ "http://www.foxnews.com",_ "http://www.msn.com",_ "http://www.wired.com",_ "http://www.sky.com",_ "http://www.usatoday.com",_ "http://www.cbs.com",_ "http://www.nbc.com",_ "http://slashdot.org",_ "http://www.bloglines.com",_ "http://www.techweb.com",_ "http://www.newslink.org",_ "http://www.un.org") multi = new MyCURLSMultiMBS for i as integer = 1 to 20 DownloadOneURL next End EventHandler
Sub DownloadOneURL() if UBound(urls) = -1 then Return dim c as new CURLSMBS dim URL as string = URLs.Pop c.CollectDebugMessages = true c.CollectHeaders = true c.CollectOutputData = true c.OptionVerbose = true c.OptionURL = URL c.OptionFollowLocation = true c.OptionMaxRedirs = 3 if Multi.AddCURL(c) then log "Downloading: "+URL // ok else Break end if End Sub
Sub log(s as string) List.AddRow s List.ScrollPosition = List.LastIndex End Sub
Property Multi As MyCURLSMultiMBS
Property urls() As string
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyCURLSMultiMBS Inherits CURLSMultiMBS
EventHandler Sub TransferFinished(curl as CURLSMBS, result as Integer, RemainingFinishedTransfers as Integer) // check this in debugger if you like dim outputData as string = curl.OutputData dim DebugMessages as string = curl.DebugMessages #Pragma Unused outputData #Pragma Unused DebugMessages 'break MainWindow.log "Transfer done with error code "+str(result)+" for "+curl.OptionURL+", "+str(me.RunningTransfers)+" transfers running." MainWindow.DownloadOneURL End EventHandler
EventHandler Sub TransfersFinished() MainWindow.log "All done" MainWindow.Timer1.Mode = timer.ModeOff End EventHandler
End Class
End Project

See also:

The items on this page are in the following plugins: MBS CURL Plugin.


The biggest plugin in space...