Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.js

Visual Basic 6.0 Examples

Async
Certificates
ECC
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
JSON
MHT / HTML Email
PEM
PFX/P12
Java KeyStore (JKS)
POP3
RSA Encryption
MIME
REST
SCP
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Stream
Tar Archive
XML
XMP
Zip

More Examples...
Google APIs
Google Cloud Storage
Azure Cloud Storage
Amazon S3 (new)
Google Drive
ASN.1
PRNG
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
DSA
NTLM
QuickBooks

 

 

 

 

 

 

 

(Visual Basic 6.0) 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 ActiveX Downloads

ActiveX for 32-bit and 64-bit Windows

'  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 ChilkatRest
Dim socket As New ChilkatSocket

'  Establish the connection using the socket object:
Dim bTls As Long
bTls = 0
Dim port As Long
port = 80
Dim maxWaitMs As Long
maxWaitMs = 5000
Dim success As Long
success = socket.Connect("dev.markitondemand.com",port,bTls,maxWaitMs)
If (success <> 1) Then
    Text1.Text = Text1.Text & "Connect Failure Error Code: " & socket.ConnectFailReason & vbCrLf
    Text1.Text = Text1.Text & socket.LastErrorText & vbCrLf
    Exit Sub
End If

'  Use the connection:
success = rest.UseConnection(socket)
If (success <> 1) Then
    Text1.Text = Text1.Text & rest.LastErrorText & vbCrLf
    Exit Sub
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 <> 1) Then
    Text1.Text = Text1.Text & rest.LastErrorText & vbCrLf
    Exit Sub
End If

Dim xml As New ChilkatXml
success = xml.LoadXml(responseXml)
Text1.Text = Text1.Text & "LastPrice: " & xml.GetChildContent("LastPrice") & vbCrLf

 

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