1 2 package ch.ethz.ssh2; 3 4 import java.io.IOException ; 5 import java.io.InputStream ; 6 import java.io.OutputStream ; 7 8 import ch.ethz.ssh2.channel.Channel; 9 import ch.ethz.ssh2.channel.ChannelManager; 10 import ch.ethz.ssh2.channel.LocalAcceptThread; 11 12 20 public class LocalStreamForwarder 21 { 22 ChannelManager cm; 23 24 String host_to_connect; 25 int port_to_connect; 26 LocalAcceptThread lat; 27 28 Channel cn; 29 30 LocalStreamForwarder(ChannelManager cm, String host_to_connect, int port_to_connect) throws IOException 31 { 32 this.cm = cm; 33 this.host_to_connect = host_to_connect; 34 this.port_to_connect = port_to_connect; 35 36 cn = cm.openDirectTCPIPChannel(host_to_connect, port_to_connect, "127.0.0.1", 0); 37 } 38 39 43 public InputStream getInputStream() throws IOException 44 { 45 return cn.getStdoutStream(); 46 } 47 48 58 public OutputStream getOutputStream() throws IOException 59 { 60 return cn.getStdinStream(); 61 } 62 63 73 public void close() throws IOException 74 { 75 cm.closeChannel(cn, "Closed due to user request.", true); 76 } 77 } 78 | Popular Tags |