Package com.jcraft.jsch

Examples of com.jcraft.jsch.Channel.connect()


            session.setPort(port);
            session.setPassword(password);
            session.connect();

            Channel channel = session.openChannel(CHANNEL_SFTP);
            channel.connect();

            channelSftp = (ChannelSftp) channel;
            setHome(channelSftp.pwd());
        }
        catch (JSchException e)
View Full Code Here


            session.setConfig(hash);
            session.setPort(port);
            session.connect();

            Channel channel = session.openChannel(CHANNEL_SFTP);
            channel.connect();

            channelSftp = (ChannelSftp) channel;
            setHome(channelSftp.pwd());
        }
        catch (JSchException e)
View Full Code Here

    try {
      // @TODO: Fix so that this operation is generic and casting to
      // JschSession is no longer necessary.
      final Channel channel = ((JschSession) getSession())
          .getSftpChannel();
      channel.connect(tms);
      return (ChannelSftp) channel;
    } catch (JSchException je) {
      throw new TransportException(uri, je.getMessage(), je);
    }
  }
View Full Code Here

    BufferedReader reader = null;
    try {
      session.openChannel("exec");
      channel = session.openChannel("exec");
      ((ChannelExec) channel).setCommand(command);
      channel.connect();
      return sshStream.getLines(channel);
    } catch (JSchException e) {
      throw new OpenShiftSSHOperationException(e, "Failed to list forwardable ports for application \"{0}\"",
          this.getName());
    } catch (IOException e) {
View Full Code Here

            Reader outStrBufRdr = new BufferedReader(outStrRdr);

            StringBuffer stdout = new StringBuffer();
            StringBuffer stderr = new StringBuffer();

            channel.connect(5000)// timeout after 5 seconds
            while (true) {
                if (channel.isClosed()) {
                    break;
                }
View Full Code Here

            // get I/O streams for remote scp
            OutputStream out=channel.getOutputStream();
            InputStream in=channel.getInputStream();

            channel.connect();

            if(checkAck(in)!=0){
                return false;
            }
View Full Code Here

            // get I/O streams for remote scp
            OutputStream out=channel.getOutputStream();
            InputStream in=channel.getInputStream();

            channel.connect();
            byte[] buf=new byte[1024];

            // send '\0'
            buf[0]=0; out.write(buf, 0, 1); out.flush();
View Full Code Here

    BufferedReader reader = null;
    try {
      session.openChannel("exec");
      channel = session.openChannel("exec");
      ((ChannelExec) channel).setCommand(command);
      channel.connect();
      return sshStream.getLines(channel);
    } catch (JSchException e) {
      throw new OpenShiftSSHOperationException(e, "Failed to execute remote ssh command \"{0}\"",
          this.getName());
    } catch (IOException e) {
View Full Code Here

      /*
       * // Set environment variable "LANG" as "ja_JP.eucJP". ((ChannelShell)channel).setEnv("LANG", "ja_JP.eucJP");
       */

      // channel.connect();
      channel.connect(3 * 1000);
  } catch (Exception e) {
      System.out.println(e);
  }
    }

View Full Code Here

    try {
      ((ChannelExec)channel).setCommand(command);
      InputStream in=channel.getInputStream();
      channel.setInputStream(null);
      ((ChannelExec)channel).setErrStream(System.err);
       channel.connect();       
       res=FileUtil.readInputStreamToString(in, "UTF-8");
       in=null;
//       log.info("命令:"+command+"执行完毕\n");
//       log.info("命令执行结果为:\n"+res);
    } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.