Package com.jcraft.jsch

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


       Channel channel=session.openChannel("exec");
       ((ChannelExec)channel).setCommand(command);
//       channel.setInputStream(inputData);
//       channel.setOutputStream(outputData);
      
       channel.connect();
   }
  
  /**
* @param arg
*/
 
View Full Code Here


      //((ChannelExec)channel).setErrStream(fos);
      ((ChannelExec)channel).setErrStream(System.err);

      InputStream in=channel.getInputStream();

      channel.connect();

      byte[] tmp=new byte[1024];
      while(true){
        while(in.available()>0){
          int i=in.read(tmp, 0, 1024);
View Full Code Here

    session.setUserInfo(new PresetUserInfo(x.getAuth().getPassword(), null));
    session.connect(30000);
    final Channel channel=session.openChannel("shell");
    channel.setInputStream(System.in);
    channel.setOutputStream(System.out);
    channel.connect(3000);
    try {
      while (channel.isConnected()) {
        Thread.sleep(250); // bit rubbish way of doing this
      }
    } finally {
View Full Code Here

            LOGGER.info("Exec " + command);

            // Open an execution channel that supports SSH agent forwarding
            Channel channel = sess.openChannel("exec");
            ((ChannelExec) channel).setCommand(command);
            channel.connect();

            // Wait for the channel to close
            while (true) {
                if (channel.isClosed()) {
                    break;
View Full Code Here

            //jar-cache parameter needed for jenkins 1.540+
            ((ChannelExec) slaveChannel)
            .setCommand("java -jar $OPENSHIFT_DATA_DIR/jenkins/slave.jar -jar-cache "+jarCachePath);
            InputStream serverOutput = slaveChannel.getInputStream();
            OutputStream clientInput = slaveChannel.getOutputStream();
            slaveChannel.connect();
            if (slaveChannel.isClosed()) {
                LOGGER.severe("Slave connection terminated early with exit = "
                        + channel.getExitStatus());
            }
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

        try {

            OutputStream out = channel.getOutputStream();
            InputStream in = channel.getInputStream();

            channel.connect();

            waitForAck(in);
            sendFileToRemote(localFile, in, out);
        } finally {
            if (channel != null) {
View Full Code Here

        Channel channel = openExecChannel("scp -r -d -t " + remotePath);
        try {
            OutputStream out = channel.getOutputStream();
            InputStream in = channel.getInputStream();

            channel.connect();

            waitForAck(in);
            for (Iterator i = directoryList.iterator(); i.hasNext();) {
                Directory current = (Directory) i.next();
                sendDirectory(current, in, out);
View Full Code Here

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

            channel.connect();

            sendAck(out);
            startRemoteCpProtocol(in, out, localFile);
        } finally {
            if (channel != null) {
View Full Code Here

            }

            session.connect();

            Channel channel = session.openChannel("sftp");
            channel.connect();
            ChannelSftp c = (ChannelSftp) channel;

            File downloadFile = new File(path);
            FileOutputStream tempFileOutputStream =
                    new FileOutputStream(downloadFile);
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.