oh.. and the channel exist status is 0.

On Wed, May 18, 2016 at 1:45 PM, Offer Baruch <offerbar...@gmail.com> wrote:

> ok... tried it as it is in the example and i still get the same result...
> every once in a while i get nothing back. that is the channel is closed
> and there is no available stuff to read.
>
> On Wed, May 18, 2016 at 1:30 PM, Offer Baruch <offerbar...@gmail.com>
> wrote:
>
>> but read should block until you get data or you reach EOF... it shouldn't
>> return -1 if there might be anymore data...
>> as -1 (End Of File) was returned that means that no more data is
>> available.
>>
>> anyway i will give it a try and report back.
>>
>> On Wed, May 18, 2016 at 12:48 PM, Tobia Conforto <
>> tobia.confo...@gruppo4.eu> wrote:
>>
>>> Then I believe it's a race condition.
>>>
>>> You are looping until connIn.read() returns -1, but that only means that
>>> *for now* there is no more data to read. It doesn't mean that the remote
>>> command is done. So if the remote server takes a few millisecond more to
>>> run the command, your Java program will get a -1 from read() and exit the
>>> loop, instead of waiting for any more data.
>>>
>>> I suggest you study the examples provided with JSch, starting from the
>>> one about Exec[1], where you will see the only condition that can ever
>>> leave the main while(true) is basically: channel.isClosed() && !
>>> in.available()>0
>>>
>>> Tobia
>>>
>>> [1] http://www.jcraft.com/jsch/examples/Exec.java.html
>>>
>>> On 18 May 2016, at 11:38, Offer Baruch <offerbar...@gmail.com> wrote:
>>> > basically i get into a read loop:
>>> > while (!endOfIn) {
>>> >                 i = connIn.read(tmp, 0, tempBufLen);
>>> >                 if (i < 0) {
>>> >                     endOfIn = true;
>>> >                     break;
>>> >                 }
>>> > ...
>>> > }
>>> > although this is surrounded by try and catch there is no exception
>>> raised...
>>> > i simply returns -1.
>>> > the command is in fact get run on the host... i just loose the output
>>> of the command.
>>>
>>>
>>
>
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to