X-Git-Url: https://git.ralfj.de/saartuer.git/blobdiff_plain/5bceb6534d5f640dcdd4d5015cecfbad4e82a7b7..73cd08c855a77bc0df90d6e94f6d75d42d6f5e5e:/AndTuer/src/de/hacksaar/andtuer/AsyncTyshell.java 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) {