-
-
Notifications
You must be signed in to change notification settings - Fork 11
HTTP persistent connection example
Andrew Lambert edited this page Nov 26, 2022
·
7 revisions
Connection reuse is on by default and will be used if the server and protocol both support it. Use the same EasyHandle when making multiple requests of the same server to take advantage of this feature.
This example retrieves a web page and an image from the same website. If the server supports it then both transfers will use the same connection.
Dim c As New cURLClient
Dim page As String
Dim logo As Picture
If c.Get("http://www.example.com/index.html") Then ' Transfer #1
page = c.GetDownloadedData
End If
If c.Get("http://www.example.com/logo.png") Then ' Transfer #2
logo = Picture.FromData(c.GetDownloadedData)
End If
To disable connection reuse, set EasyHandle.AutoDisconnect to True
.
Refer to the MultiHandle class for HTTP pipelining and multiplexing.
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.