Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Classic ASP Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
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
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

SSH Tunnel using an HTTP proxy

Demonstrates how to establish an SSH tunnel that uses an HTTP proxy.

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set sshTunnel = Server.CreateObject("Chilkat_9_5_0.SshTunnel")

success = sshTunnel.UnlockComponent("30-day trial")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(sshTunnel.LastErrorText) & "</pre>"

End If

'  The DestHostname / DestPort is the server with which we
'  are ultimately communicating.
sshTunnel.DestPort = 1433
sshTunnel.DestHostname = "myServer.com"

'  Provide information about the location of the SSH server,
'  and the authentication to be used with it. This is the
'  login information for the SSH server.
sshTunnel.SshHostname = "192.168.1.108"
sshTunnel.SshPort = 22
sshTunnel.SshLogin = "mySshLogin"
sshTunnel.SshPassword = "mySshPassword"

'  To connect through an HTTP proxy, set the HttpProxyHostname
'  and HttpProxyPort properties to the hostname (or IP address)
'  and port of the HTTP proxy.  Typical port numbers used by
'  HTTP proxy servers are 3128 and 8080.
sshTunnel.HttpProxyHostname = "www.my-http-proxy.com"
sshTunnel.HttpProxyPort = 3128

'  Important:  Your HTTP proxy server must allow non-HTTP
'  traffic to pass.  Otherwise this does not work.

'  Start accepting connections in a background thread.
'  The SSH tunnels are autonomously run in a background
'  thread.  There is one background thread for accepting
'  connections, and another for managing the tunnel pool.
listenPort = 3316
success = sshTunnel.BeginAccepting(listenPort)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(sshTunnel.LastErrorText) & "</pre>"

End If

'  At this point you may write code to communicate with
'  the server at DestHostname/DestPort.  This could be anything --
'  it could be WinSock, ADO/ODBC code, Chilkat Socket, etc.
'  However, instead of connecting directly to DestHostname/DestPort,
'  your code would connect to localhost:3316 (because this
'  is the listenPort of the SSH Tunnel

'  This is what happens when you connect to localhost:3316
'  1) The connection is accepted by the SSH tunnel
'      background thread (which was started in the call to BeginAccepting).
'  2) In the background thread, a connection to a remote SSH
'      server is established via an HTTP proxy.
'  3) Port-forwarding is setup so that the remote SSH server connects
'     to the DestHostname/DestPort.
'  4) Data sent by your application to localhost:3316 is ultimately forwarded to DestHostname/DestPort
'   5) Data sent back from DestHostname/DestPort is forwarded back and received by your application

'  When you're finished with the  connection, you may
'  stop the background tunnel threads:
'  Stop the background thread that accepts new connections:
success = sshTunnel.StopAccepting()
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(sshTunnel.LastErrorText) & "</pre>"

End If

'  If any background tunnels are still in existence (and managed
'  by a single SSH tunnel pool background thread), stop them...
maxWaitMs = 1000
success = sshTunnel.StopAllTunnels(maxWaitMs)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode(sshTunnel.LastErrorText) & "</pre>"

End If

%>
</body>
</html>

 

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