Friday, September 10, 2010

[android-developers] Re: buffer blocked until process exited

I suspect you need to flush the buffer on the write end.

On Sep 10, 9:33 am, Compmanic <sriniva...@gmail.com> wrote:
> I have a problem with blocking buffer with the following code on my
> android application:
>
>      else if (tcpdumpButton.isChecked())
>                {
>                   try
>                   {
>                      Process process1 =
> Runtime.getRuntime().exec("tcpdump");
>                      BufferedReader osRes = new BufferedReader(new
> InputStreamReader(process1.getInputStream()));
>                      StringBuffer output = new StringBuffer();
>                      String line="";
>                      while ((line = osRes.readLine()) != null)
>                      {
>                         output.append(line);
>                         output.append("\n");
>                         tv.setText(output);
>                         setContentView(tv);
>                      }
>                   }
>                   catch (Exception e)
>                   {
>                      throw e;
>                   }
>
>                }
> Since the tcpdump process is running continuously and never terminated
> i am unable to print the buffer contents on the screen.Can anybody
> tell me what i should do or give an example on how to read the buffer
> and print it on the screen without waiting for the process to
> terminate??

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate