Thanks, Paul.
This is Yukimasa.
I'm looking forward your new report.
And I have to correct my source code.
I didn't read InputStream, I used channel.setOutputStream();
Even if channel fails to detect close, inputstream.read()
maybe thow IOException.
Or, inputstream.read() may be blocked forever?
I'm not sure which happens.
------ source code -------------------------------
while( true ){ // infinite loop
try{
Channel channel=session.openChannel("exec");
((ChannelExec)channel).setCommand( "ls" );
channel.setInputStream(null);
((ChannelExec)channel).setErrStream(System.err);
// instead of read IuputStream of
OutputStream os = new ByteArrayOutputStream();
channel.setOutputStream( os );
channel.connect();
while(true){ // wait command end
if(channel.isClosed()){
System.out.println("exit-status: "+channel.getExitStatus());
break;
}
// for debug, if miss isClosed()
if( !channel.isClosed() && channel.getExitStatus() == 0 ){
System.out.println("before close exit-status changed!" );
}
try{
Thread.sleep(1000);
}catch(Exception ee){}
} // while( true ){ //wait command end
channel.disconnect();
os.close();
} catch(Exception e){
System.out.println(e);
}
}// while( true ){ // infinite loop
------ source code -------------------------------
> These are very good questions. I have encountered both recently myself.
> I also can attest that disconnects I know to exist were not reported
> by my running application, so either I misunderstand the semantics of
> Channel.isClosed() and/or Channel.isConnected() or in fact there is a
> bug in this part of the JSch library.
>
> In the course of writing some test code to determine what the actual
> behavior is (as opposed to what it should be --- there is no spec at
> this level as far as I can determine) the question arose in my mind:
> can a Channel object be opened, connected, disconnected and closed
> multiple times within a single Session object? I will follow up with my
> experimental results soon.
>
> Thanks,
>
> -pmr
--
----------------------------------
Yukimasa Matsuda
Quatre-i Science Co., Ltd.
e-mail: [email protected]
http://www.i4s.co.jp
----------------------------------
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
JSch-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users