X-Git-Url: https://git.ralfj.de/saartuer.git/blobdiff_plain/5bceb6534d5f640dcdd4d5015cecfbad4e82a7b7..eb3e24210b024a3393e629f133bef7c66eddceae:/AndTuer/src/de/hacksaar/andtuer/AsyncTyshell.java?ds=sidebyside diff --git a/AndTuer/src/de/hacksaar/andtuer/AsyncTyshell.java b/AndTuer/src/de/hacksaar/andtuer/AsyncTyshell.java index 4dcdcaf..6236988 100644 --- a/AndTuer/src/de/hacksaar/andtuer/AsyncTyshell.java +++ b/AndTuer/src/de/hacksaar/andtuer/AsyncTyshell.java @@ -5,6 +5,10 @@ import android.util.Log; import de.hacksaar.javatuer.InteractiveLogin; import de.hacksaar.javatuer.TyshellClient; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.util.LinkedList; import java.util.Queue; @@ -50,10 +54,28 @@ class AsyncTyshell extends AsyncTask { } } + private void readUnlimited(InputStreamReader inputStreamReader) { + final BufferedReader reader = new BufferedReader(inputStreamReader); + new Thread(new Runnable() { + @Override + public void run() { + String line; + try { + while((line = reader.readLine()) != null) { + prompter.sendMessage(line); + } + } catch (Exception e) { + Log.w("end read unlimited!", e); + } + } + }).start(); + } + @Override protected Void doInBackground(Void... voids) { TyshellClient client = new TyshellClient(hostname, port, new AndroidLogging()); client.connect(username, keyFile, new AsyncInteractiveLogin()); + readUnlimited(client.getInputStream()); while (disconnect) { String msg = null; synchronized (messages) {