Build tcpdump with Android source code, you can do by this(Use nexus 7 I for example):
1. Go to your code root path.
2. source ./build/envsetup.sh; lunch aosp_grouper-userdebug
3. make -j4 tcpdump
You should get tcpdump under folder out/target/product/grouper/system/xbin
Steps to use tcpdump:
On PC:
adb root
adb remount
adb push tcpdump /system/xbin/
adb shell chmod 0755 /system/xbin/tcpdump
adb shell
On device:
adb remount
adb push tcpdump /system/xbin/
adb shell chmod 0755 /system/xbin/tcpdump
adb shell
Run the following command:
tcpdump -p -vv -s 0 -w <file on device to save the data> -i wlan0 host <server IP>
Sample:
tcpdump -p -vv -s 0 -w /sdcard/capture.pcap -i wlan0 host 192.168.1.10
On PC:
adb pull /sdcard/capture.pcap .
then you can use wireshark to read the data.
Useful links