Friday, September 10, 2010

[android-developers] buffer blocked until process exited

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

No comments:

Post a Comment