Hi,

   +-From: "Karthikeyan Thiruvoo Sivanaiah" <[EMAIL PROTECTED]> --
   |_Date: Fri, 22 Feb 2008 19:16:21 +0530 __
   |
   |Thru this pgm i enter into a remote machine and execute commands.
   |after execution of each commands, i need to read the output.
   |after that i have to close the channel and session.
   |but it is not working. Also it does not give any exception.
   |i have attached the code.

   |public class OAMLocal {
   ...
   |    public static void executeScript_telnet(String ip,String 
username,String password,String staticip,String call) throws Exception
   |    { 
   ...
   |            try{
   |            channel = session.openChannel("shell");}
   |            catch(Exception e)
   |            {
   |                    session.disconnect();
   |                    System.out.println("OAMCE: Could not connect to "+ip+". 
Channel open failed.\n"+e.toString());
   |                    
   |            }

   /*
   |            try{    
   |            System.out.println("OAMCE: Telnet Command : "+ip);
   |            channel.setInputStream(System.in);
   |            channel.setOutputStream(System.out);
   |            channel.connect();}             
   |            catch(Exception e)
   |            {
   ...
   |            }
   |            try{    
   |            in = channel.getInputStream();
   |            out = new PrintStream( channel.getOutputStream() );
   |            }
   |            catch( Exception e )
   |            {
   ...
   |            }       
   */

                System.out.println("OAMCE: Telnet Command : "+ip);
                try{    
                in = channel.getInputStream();
                out = new PrintStream( channel.getOutputStream() );
                channel.connect();
                }
                catch( Exception e )
                {
                         session.disconnect();
                         System.out.println("OAMCE: Could not connect to 
"+ip+". Wrong Password.\n"+e.toString());
                         
                }       

   |                     if(call.compareTo("sys_read") == 0)
   |                     {
   ...


--
Atsuhiko Yamanaka
JCraft,Inc.
1-14-20 HONCHO AOBA-KU,
SENDAI, MIYAGI 980-0014 Japan.
Tel +81-22-723-2150
    +1-415-578-3454
Fax +81-22-224-8773
Skype callto://jcraft/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to