-
-
Notifications
You must be signed in to change notification settings - Fork 4
SSH.TCPTunnel
Andrew Lambert edited this page Nov 8, 2020
·
25 revisions
SSH.TCPTunnel
Protected Class TCPTunnel
Inherits SSH.Channel
This class represents a TCP connection that is being forwarded over the SSH session. To initiate an outbound connection from the client to a third party, using the SSH server as an intermediary, call the Connect()
method. To accept inbound connections from a third-party refer to the TCPListener class.
This example forwards an HTTP request through the SSH server to www.google.com:80
.
Dim session As SSH.Session = SSH.Connect("ssh.example.com", 22, "username", "password")
Dim tunnel As New SSH.TCPTunnel(Session)
tunnel.RemoteAddress = "www.google.com"
tunnel.RemotePort = 80
If Not tunnel.Connect() Then MsgBox("Unable to open tunnel.")
' write to the tunnel
tunnel.Write( _
"GET / HTTP/1.0" + EndOfLine.Windows + _
"Host: www.google.com" + EndOfLine.Windows + _
"Connection: close" + EndOfLine.Windows + EndOfLine.Windows)
' read from the tunnel
Dim output As String
Do Until tunnel.EOF
If tunnel.PollReadable() Then
output = output + tunnel.Read(tunnel.BytesReadable)
End If
Loop
- Close
- Connect
- EOF
- Flush
- Poll
- PollReadable
- PollWriteable
- Read
- ReadError
- WaitClose
- WaitEOF
- Write
- WriteError
- BytesReadable As UInt32
- BytesWriteable As UInt32
- Handle As Ptr
- IsOpen As Boolean
- LastError As Int32
- LocalInterface As NetworkInterface
- LocalPort As Integer
- ReadWindow As UInt32
- RemoteAddress As String
- RemoteBytesWriteable As UInt32
- RemotePort As Integer
- Session As SSH.Session
- WriteWindow As UInt32
- Channel class
- TCPListener class
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2018-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.