Re: [JSch-users] a question regarding subsystem
Status: Alpha
Brought to you by:
ymnk
From: <ym...@jc...> - 2005-07-20 22:52:20
|
Hi, +-From: "Yong Chen (yongche)" <ch...@ci...> -- |_Date: Wed, 20 Jul 2005 15:18:09 -0700 _________ | |The example program works, but it reads input from System.in and |displays response on System.out. I want to be able to catch the |response and parse it. How about following lines? Channel channel=session.openChannel("subsystem"); ((ChannelSubsystem)channel).setSubsystem(subsystem); ((ChannelSubsystem)channel).setPty(true); InputStream in = channel.getInputStream(); OutputStream out = channel.getOutputStream(); channel.connect(); out.write("your message".getBytes()); byte[] tmp=new byte[1024]; int i=in.read(tmp, 0, 1024); // parse data in tmp Sincerely, -- Atsuhiko Yamanaka JCraft,Inc. 4-1 OHMACHI 1-CHOME AOBA-KU, SENDAI, MIYAGI 980-0804 Japan. Tel +81-22-723-2150 +1-415-578-3454 Fax +81-22-224-8773 Skype callto://jcraft/ |