aluis-rcastro / AI2_ANDROID_SSH_CLIENT_EXTENSION

Android client SSH extension for MIT Application Inventor 2
MIT License
10 stars 6 forks source link

How to append all log NOT only the last line of recived messages #10

Open solyman opened 3 years ago

solyman commented 3 years ago

Hello! Andre Luis,

First of all I would like to thank you your extension. It's incredible.

second I am trying to send more than on command one after another & I try to collect all the received messages came from server (not only the last line) , but unfortunately I did not get it to work OK thought I try more than one scenario

here is the method I used in my project by appending to txt file then read that file , but the result was not correct

kindly I need your support to get all the revived output not only the last line

blocks
aluis-rcastro commented 3 years ago

It's a long time since I did this program, however if I'm not missing something, at a glance seems like you are likely not doing things the correct way. Opperations like "read" and "write" (to file) cannot be performed inline as such since are not done by callback functions. You should catch file events as "read done/write done" to trigger the corresponding read and write process.

solyman commented 3 years ago

Hello! Andre Luis,

can I have more details (an example or something like that ) on how to get it work

Thank you inadvance

aluis-rcastro commented 3 years ago

Refer to the file "GotText" component, placed at the 2min57s on the folowing video:

How to Read File in MIT App Inventor 2 [ File Component ]

Note that you start reading with the "readFrom" method, but file content acquisition is effectively made upon "GotText" event. This happens because java processing time occurs much faster thatn peripherals timings, so a synchronization feature as such is needed.