Hi,
Is it possible to create a application that gets network activity / statistics while running as a background process? Or just make a application that listen to traffic on a specific port?
Thanks M
Hi,
Is it possible to create a application that gets network activity / statistics while running as a background process? Or just make a application that listen to traffic on a specific port?
Thanks M
It maybe hit and miss. But most devices I have used have the /proc file system. You should be able to get the stats you need out of one of the /proc/net/ entries. For example to get a netstat:
Process proc = Runtime.getRuntime().exec(new String[] {"cat", "/proc/net/netstat"});
BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null)
{
// parse netstat output here
}