Search code examples
androidhttpios-simulatorpcaplibpcap

capture traffic from emulator to a server on the same machine


I am trying to capture http traffic using pcap4j from an android emulator / ios simulator to a server which is hosted on the same machine. The machine can run either linux / windows or osx.

I tried capturing packets from wireshark first for testing, but it didn't catch any. I guess this is because the emulator uses the loopback interface to talk to the server since they are running on the same machine. Is there any way I can capture the traffic other than making the emulators use a sort of "man in the middle http proxy"?

Thanks.


Solution

  • I tried capturing packets from wireshark first for testing, but it didn't catch any. I guess this is because the emulator uses the loopback interface to talk to the server since they are running on the same machine

    Yes, so, unless you capture on the loopback interface, you won't see the traffic. On Linux, that interface is called "lo"; on OS X (and most other UN*Xes), it's called "lo0". On Windows, you're out of luck, unfortunately.