Use tcpdump to debug android Network programs

Source: Internet
Author: User
By default, no tcpdump is available for Android, and the next version of other people's port on the Internet is enough. this is easy to google and I will not go into details. You can also download the source code from the http://www.tcpdump.org. After NDKr5, compile it with toolchain. If we use tcpdump to debug the http program, we can write as follows: Android does not TcpdumpFrom the next version of other people's port on the Internet, this is easy to google, and I will not go into details. You can also use http: // www. Tcpdump. Org download source code compilation. After NDK r5, compile it with toolchain.
If we use tcpdump to debug the http program, we can write as follows:
Tcpdump-p-nnn-vvv-s 0-w/sdcard/1. pcap port 80 and tcp
-P is not a hybrid mode, but if it is 3G/GPRS, the difference is not big...
-Nnn displays the IP address and port directly without resolving the address.
-S 0 is best to add, otherwise many packets will be truncated, it will not be complete
-W: Save to sdcard
Port 80 and tcp. only requests on port 80 are allowed. it is more appropriate to debug http communication.
The stored pcap file can be conveniently viewed Using Wireshark.
Related Article

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.