-
-
Notifications
You must be signed in to change notification settings - Fork 11
DICT example
Andrew Lambert edited this page Jan 8, 2023
·
12 revisions
The DICT protocol is for requesting the definition of words over the Internet.
This example performs a synchronous DICT request on the calling thread for the word "antediluvian":
Dim curl As New cURLClient
If Not curl.Get("dict://dict.org/d:antediluvian") Then
MsgBox("curl error: " + Str(curl.LastError))
End If
Dim definition As String = curl.GetDownloadedData
This example performs an asynchronous DICT lookup request in a console application, and prints the output directly to the screen. The Get
method accepts an optional Writeable
object to which downloaded data should be written. Because this is a console application an event loop must be supplied for the asynchronous transfers to run on:
Dim curl As New cURLClient
curl.Get("dict://dict.org/d:antediluvian", stdout)
Do
App.DoEvents() ' async transfers require an event loop!
Loop Until curl.IsTransferComplete
If curl.LastError <> 0 Then
Print("curl error: " + Str(curl.LastError))
End If
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.