Sha256: 958776eac057fde918742e0e4fea13137e0ca1b8d2210dcc7dbcae67072b8126

Contents?: true

Size: 956 Bytes

Versions: 15

Compression:

Stored size: 956 Bytes

Contents

Forwarding remote connections to the local host is also straightforward; simply call the @#remote_to@ method of the @#forward@ service. This takes three (or four) parameters: the local port and host to be forwarded to (in that order), and the remote port to listen on. The fourth parameter is optional, and is the bind address on the remote machine; this defaults to "127.0.0.1".

{{{lang=ruby,number=true,caption=Forwarding a remote port
Net::SSH.start( 'host' ) do |session|
  session.forward.remote_to( 80, 'www.google.com', 1234 )
  session.loop
end
}}}

The above example causes any connection on port 1234 of the remote machine (_from_ the remote machine) to be forwarded via the local host to port 80 at www.google.com. To make things a bit more open, you could specify a bind address of 0.0.0.0:

{{{lang=ruby,caption=Specifying the bind address when forwarding a remote port
session.forward.remote_to( 80, 'www.google.com', 1234, '0.0.0.0' )
}}}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
net-ssh-1.0.1 doc/manual/parts/0026.txt
net-ssh-1.0.10 doc/manual/parts/0026.txt
net-ssh-1.0.8 doc/manual/parts/0026.txt
net-ssh-1.0.2 doc/manual/parts/0026.txt
net-ssh-1.0.5 doc/manual/parts/0026.txt
net-ssh-1.0.3 doc/manual/parts/0026.txt
net-ssh-1.0.6 doc/manual/parts/0026.txt
net-ssh-1.0.7 doc/manual/parts/0026.txt
net-ssh-1.0.4 doc/manual/parts/0026.txt
net-ssh-1.0.9 doc/manual/parts/0026.txt
net-ssh-1.1.2 doc/manual/parts/0026.txt
net-ssh-1.1.0 doc/manual/parts/0026.txt
net-ssh-1.1.1 doc/manual/parts/0026.txt
net-ssh-1.1.3 doc/manual/parts/0026.txt
net-ssh-1.1.4 doc/manual/parts/0026.txt