Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Xojo Plugin Examples

Web API Categories

ASN.1
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Service Bus
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Compression
DKIM / DomainKey
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
ECC
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
Geolocation
Google APIs
Google Calendar
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text

HTTP
HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
Microsoft Graph
NTLM
OAuth1
OAuth2
OneDrive
OpenSSL
Outlook
PEM
PFX/P12
POP3
PRNG
REST
REST Misc
RSA Encryption
SCP
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
SharePoint
Socket/SSL/TLS
Spider
Stream
Tar Archive
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Xojo Plugin) Use Socket Object for the Connection

The Chilkat Socket API provides many features for establishing connections, which includes the following:

  • Connect through an HTTP proxy
  • Connect through a SOCKS proxy
  • Connect through an SSH tunnel
  • Binding to a local IP address
  • Client-side Certificates (two-way SSL/TLS)
  • Public Key Pinning for TLS connections
  • Controlling TLS ciphers

Rather than reproducing all of the properties and methods required for these features, the REST object can use a Socket object's connection by calling the UseConnection method. This allows for an application to use the features of the Socket API to establish the connection, and then use it from the REST API.

Chilkat Xojo Plugin Download

Xojo Plugin for Windows, Linux, Mac OS X, and ARM

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

//  This example shows how to use the Chilkat socket object's connection.
Dim rest As New Chilkat.Rest
Dim socket As New Chilkat.Socket

//  Establish the connection using the socket object:
Dim bTls As Boolean
bTls = False
Dim port As Int32
port = 80
Dim maxWaitMs As Int32
maxWaitMs = 5000
Dim success As Boolean
success = socket.Connect("dev.markitondemand.com",port,bTls,maxWaitMs)
If (success <> True) Then
    System.DebugLog("Connect Failure Error Code: " + Str(socket.ConnectFailReason))
    System.DebugLog(socket.LastErrorText)
    Return
End If

Dim bAutoReconnect As Boolean
bAutoReconnect = True

//  Use the connection:
success = rest.UseConnection(socket,bAutoReconnect)
If (success <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

//  Get a stock quote:
success = rest.AddQueryParam("symbol","AAPL")
Dim responseXml As String
responseXml = rest.FullRequestNoBody("GET","/MODApis/Api/v2/Quote")
If (rest.LastMethodSuccess <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

Dim xml As New Chilkat.Xml
success = xml.LoadXml(responseXml)
System.DebugLog("LastPrice: " + xml.GetChildContent("LastPrice"))

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.