示例#1
0
文件: SshHelper.cs 项目: itsbth/GLuaR
        public SshHelper(string host, string username, string password)
        {
            this.host = host;
            JSch jsch=new JSch();
            Session session=jsch.getSession(username, host, 22);
            session.setPassword( password );

            Hashtable config=new Hashtable();
            config.Add("StrictHostKeyChecking", "no");
            session.setConfig(config);

            session.connect();

            channel=(ChannelShell)session.openChannel("shell");

            writer_po = new PipedOutputStream();
            PipedInputStream writer_pi = new PipedInputStream( writer_po );

            PipedInputStream reader_pi = new PipedInputStream();
            PipedOutputStream reader_po = new PipedOutputStream( reader_pi );
            reader = new StreamReader (reader_pi,Encoding.UTF8);

            channel.setInputStream( writer_pi );
            channel.setOutputStream( reader_po );

            channel.connect();
            channel.setPtySize(132, 132, 1024, 768);
        }
示例#2
0
 public virtual void connect(PipedInputStream snk)
 {
     if (snk == null)
     {
         throw new NullReferenceException();
     }
     else if (sink != null || snk.connected)
     {
         throw new IOException("Already connected");
     }
     sink          = snk;
     snk.m_in      = -1;
     snk.m_out     = 0;
     snk.connected = true;
     int t = 0;
 }
示例#3
0
文件: Channel.cs 项目: itsbth/GLuaR
 internal PassiveOutputStream(PipedInputStream In)
     : base(In)
 {
 }
示例#4
0
 /**
 * Creates a piped output stream connected to the specified piped
 * input stream. Data bytes written to this stream will then be
 * available as input from <code>snk</code>.
 *
 * @param      snk   The piped input stream to connect to.
 * @exception  IOException  if an I/O error occurs.
 */
 public PipedOutputStream(PipedInputStream snk)
 {
     connect(snk);
 }
示例#5
0
 public virtual void connect(PipedInputStream snk)
 {
     if (snk == null)
     {
         throw new NullReferenceException();
     }
     else if (sink != null || snk.connected)
     {
         throw new IOException("Already connected");
     }
     sink = snk;
     snk.m_in = -1;
     snk.m_out = 0;
     snk.connected = true;
     int t=0;
 }
示例#6
0
 /**
  * Creates a piped output stream connected to the specified piped
  * input stream. Data bytes written to this stream will then be
  * available as input from <code>snk</code>.
  *
  * @param      snk   The piped input stream to connect to.
  * @exception  IOException  if an I/O error occurs.
  */
 public PipedOutputStream(PipedInputStream snk)
 {
     connect(snk);
 }