How to use tcpdump to capture packets in android development

Source: Internet
Author: User
In android development, socket programming makes it impossible to see from the log what is the packet sent and returned by the socket that communicates with it. here is a tool, the tcpdump tool and wireshark tool view the captured content. The official website of tcpdump is http://www.tcpdump.org/reference :http://surefan.iteye.com/ B. in android development, what is the packet sent and returned by the socket that communicates with the tcpdump, TcpdumpTool and wireshark tool to view captured content.
Tcpdump official website is the http://www.tcpdump.org/
Reference: http://surefan.iteye.com/blog/773917
Download the tcpdump file.
You need root permission,
Adb push c: \ wherever_you_put \ Tcpdump/Data/local/ Tcpdump
Adb shell chmod 6755/data/local/ Tcpdump

Packet capture is simple
Adb shell Tcpdump-P-vv-s 0-w/sdcard/capture. pcap
The official website explains how to use each parameter. the previous command indicates that all communication packets are captured. you can specify the port to capture packets, the captured data is stored in the sdcard capture. pcap file.
If you stop packet capture, press ctrl + c.

Export file:
Adb pull/sdcard/capture. pcap.
Use wireshark to view captured data packet files,
Adjust the time display format:




Adjust the port display format:



Then you can import the file to view it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.