- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 11
libcURL.ShareHandle
Andrew Lambert edited this page Nov 11, 2016
·
30 revisions
libcURL.ShareHandle
##Class Declaration
Public Class ShareHandle
Inherits libcURL.cURLHandle
##Remarks This class wraps the curl_share API.
EasyHandles
that are added to a ShareHandle
instance may share SSL session data, DNS caches, and/or HTTP cookies. By default nothing is shared. You must enable the share options you want before adding any EasyHandles to the share. Doing so after will raise an error (CURLSHE_IN_USE
(2))
##Methods
##Example This example creates two instances of EasyHandle and then adds both of them to a ShareHandle that is configured to share cookies only:
Dim share As New libcURL.ShareHandle
Dim easy1 As New libcURL.EasyHandle
Dim easy2 As New libcURL.EasyHandle
easy1.CookieEngine.Enabled = True
easy2.CookieEngine.Enabled = True
share.ShareCookies = True // must enable the share type first
Call share.AddItem(easy1)
Call share.AddItem(easy2)
d.URL = "www.example.com/file.html"
e.URL = "www.example.com/image.png"
Dim mb1 As New MemoryBlock(0)
Dim b1 As New BinaryStream(mb1)
d.DownloadStream = b1
Dim mb2 As New MemoryBlock(0)
Dim b2 As New BinaryStream(mb2)
easy2.DownloadStream = b2
Call easy1.Perform()
Call easy2.Perform()
b1.Close
b2.Close
Call share.RemoveItem(easy1)
Call share.RemoveItem(easy2)
##See also
-
CURLOPT_SHARE
in the libcURL documentation
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2014-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.