Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/CURL/CURLS Low Level Sockets
Function:
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 Tue, 27th Mar 2017.
Project "CURLS Low Level Sockets.rbp"
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 = true dim e as integer = c.Perform DebugText.Text = c.DebugData 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:

Feedback, Comments & Corrections

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




Links
MBS FileMaker blog