4

I want to see a list of all active TCP connections on my Android device, regardless of whether they terminate in the device.

E.g., when my phone is serving as a WiFi hotspot, I would like to see all connections that the phone is routing between the WiFi and mobile networks.

netstat doesn't show these routed connections.

My device is rooted.

3

You can use netstat -tcp and that will show you all open TCP connections.

EDIT

Per your comment, you can use busybox (a very handy app you can download from the Play store) and then you can run:
busybox netstat -nat to show what you need.

-Reference: linuxquestions

  • It doesn't seems to show what I'm looking for. netstat-nat appears to be what I want, but I haven't found it built for android. – RashaMatt May 8 '15 at 20:43
  • Answer updated to include netstat for Anroid – D. Gibbs May 8 '15 at 22:15
  • 1) netstat -tcp didn't work on Android 4.2.1. In fact, -tcp actually purged the output. 2) On Android 5.0, the output of both netstat and netstat -tcp remained same. I'm using this Busybox. 3) If I ignore 1) and 2), the output netstat -tcp doesn't explicitly mention the connections for hotspot but for the whole OS including all User/system apps. 4) Did you test this command on some Android device, or fired a shot in the wild here. :-) (Pun intended) – Firelord May 9 '15 at 6:07
  • Tested on 4.4.4, 4.4.2, 4.2.2 (Actual devices :-) ). Some had busybox, some didn't. The output was the same format for several of the devices (No UDP connections at the time I'm guessing?) I ran netstat -t instead of TCP on some devices because -tcp would spit back an error. All Samsung devices, Busybox version (when isntalled): v1.22.0.git – D. Gibbs May 9 '15 at 17:18
  • I'm still not convinced that netstat gives the info I'm looking for. What I want is accessible via cat /proc/net/ip_conntrack but it's pretty raw. netstat-nat uses this source and does some filtering and formatting. – RashaMatt May 13 '15 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.