VB.NET Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

SSH Tunnel for Database Connection (such as ADO, ODBC, etc.)

Demonstrates how to create an SSH tunneling client in a background thread of your application. This makes it possible to SSH tunnel database connections without the need for separate software (such as PuTTY) to be running.

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

Dim sshTunnel As New Chilkat.SshTunnel()

Dim success As Boolean
success = sshTunnel.UnlockComponent("30-day trial")
If (success <> true) Then
    MsgBox(sshTunnel.LastErrorText)
    Exit Sub
End If


'  The destination host/port is the database server.
'  The DestHostname may be the domain name or
'  IP address (in dotted decimal notation) of the database
'  server.
sshTunnel.DestPort = 1433
sshTunnel.DestHostname = "myDbServer.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 (not the database server).
sshTunnel.SshHostname = "192.168.1.108"
sshTunnel.SshPort = 22
sshTunnel.SshLogin = "mySshLogin"
sshTunnel.SshPassword = "mySshPassword"

'  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.
Dim listenPort As Long
listenPort = 3316
success = sshTunnel.BeginAccepting(listenPort)
If (success <> true) Then
    MsgBox(sshTunnel.LastErrorText)
    Exit Sub
End If


'  At this point you may connect to the database server through
'  the SSH tunnel.  Your database connection string would
'  use "localhost" for the hostname and 3316 for the port.
'  We're not going to show the database coding here,
'  because it can vary depending on the API you're using
'  (ADO, ODBC, OLE DB, etc. )


'  This is where your database code would go...




'  When you're finished with the database connection, you may
'  stop the background tunnel threads:
'  Stop the background thread that accepts new connections:
success = sshTunnel.StopAccepting()
If (success <> true) Then
    MsgBox(sshTunnel.LastErrorText)
    Exit Sub
End If

'  If any background tunnels are still in existence (and managed
'  by a single SSH tunnel pool background thread), stop them...
Dim maxWaitMs As Long
maxWaitMs = 1000
success = sshTunnel.StopAllTunnels(maxWaitMs)
If (success <> true) Then
    MsgBox(sshTunnel.LastErrorText)
    Exit Sub
End If

 

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

Mail Component · XML Parser