Platforms to show: All Mac Windows Linux Cross-Platform
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/CURLS Low Level Sockets
This example is the version from Wed, 3rd Jan 2023.
Project "CURLS Low Level Sockets.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control Label1 Inherits Label
ControlInstance Label1 Inherits Label
End Control
Control URL Inherits TextField
ControlInstance URL Inherits TextField
End Control
Control ConnectButton Inherits PushButton
ControlInstance ConnectButton Inherits PushButton
EventHandler Sub Action()
// let CURL connect with doing SSL and Proxy
dim c as new CURLSMBS
c.OptionURL = URL.text
c.OptionConnectOnly = 1
dim e as integer = c.Perform
DebugText.Text = c.DebugMessages
ResultText.Text = c.OutputData
if e <> 0 then
MsgBox "Failed to connect."
Return
end if
dim lines() as string
lines.Append "GET / HTTP/1.1"
lines.Append "Host: www.monkeybreadsoftware.de"
lines.Append "" // must end with two empty lines
lines.Append ""
dim Request as string = Join(lines, EndOfLine.Windows)
// send low level request over socket
dim n as integer = c.SendData(Request)
if c.Lasterror <> 0 then
Break
end if
// read something
dim Buffer as string
do
app.YieldToNextThread
dim data as MemoryBlock
dim count as integer = c.ReceiveData(data, 100000)
if c.Lasterror = c.kError_AGAIN then
// wait
continue
end if
if data <> nil then
dim datas as string = data
buffer = buffer + datas
end if
if count = 0 then
// no more?
exit
end if
loop
ResultText.Text = buffer
End EventHandler
End Control
Control ResultText Inherits TextArea
ControlInstance ResultText Inherits TextArea
End Control
Control DebugText Inherits TextArea
ControlInstance DebugText Inherits TextArea
End Control
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
End Project
See also:
- /CURL/CURLS Amazon S3 download
- /CURL/CURLS Amazon S3 upload
- /CURL/CURLS get and put/CURLS get and put
- /CURL/CURLS headers
- /CURL/CURLS post form values/CURLS post form values
- /CURL/CURLS query
- /CURL/CURLS resume download with speed measurement
- /CURL/CURLS text download
- /CURL/CURLS threaded download
- /CURL/CURLS upload to Web App/Web Upload Receiver
The items on this page are in the following plugins: MBS CURL Plugin.