Programmability i want monitor IP ever connected to my Adnroid device.
My initial thought is i can write a background service which will run tcpdump command and forward its output to inputStream. By putting any regular expression i can retrieve list of connected IP to my device.
I think that would be bulky to continually run command like tcpdump.
any better solut开发者_运维百科ion ??
Edit - typo
You'll have to choose how often to run tcpdump, and that'll be tricky - running it more frequently will have a performance impact, but running it less frequently may mean that you miss short-lived connections. Perhaps you could set up a logging "firewall" on your device using iptables ( http://www.linuxquestions.org/questions/linux-security-4/iptables-logging-385165/ ), and then parse the output of THAT whenever you actually need the output?
精彩评论