zoukankan      html  css  js  c++  java
  • Android使用tcpdump抓包

    AllJoyn中有个问题:Server切换到Client后,重新加入其他Server时join session会失败,原因是timeout(join session是异步的,在指定时间内没有收到回应)。

    之前TV和手机连接时也有这种问题,后来发现是LinkTimeout被设置为0了,将其改为40就ok了。

    但现在time out值已经是40了还报这种问题就头疼了。怎么办?

    权衡一下,我决定先抓包确认join session时数据包到底发送出去没有。

    在linux下这是一件很简单的事,tcpdump就可以搞定。但Android下还得费点心思(手机和我们的工作pc不在一个网络中,因此无法在pc上给Android抓包)。

    好在这种事很多人都做过,很容易找到他们的经验。

    1. 手机要有root权限

    2. 下载tcpdump   http://www.strazzere.com/android/tcpdump

    3. adb push c:wherever_you_puttcpdump /data/local/tcpdump

    4. adb shell chmod 6755 /data/local/tcpdump

    5, adb shell,   su获得root权限

    6, cd /data/local

    7, ./tcpdump -i any -p -s 0 -w /sdcard/capture.pcap

    命令参数:

            # "-i any": listen on any network interface

      # "-p": disable promiscuous mode (doesn't work anyway)

      # "-s 0": capture the entire packet

      # "-w": write packets to a file (rather than printing to stdout)

      ... do whatever you want to capture, then ^C to stop it ...

    8,  adb pull /sdcard/capture.pcap d:/

    9,  在电脑上用wireshark打开capture.pcap即可分析log

    http://www.cnblogs.com/likwo/archive/2012/09/06/2673944.html

  • 相关阅读:
    顺序队列的模板
    链式队列模板
    链式栈模板
    栈应用hanoi
    判断出栈顺序
    用栈实现四则运算
    两栈共享问题
    The Preliminary Contest for ICPC Asia Nanjing 2019
    Educational Codeforces Round 71 (Rated for Div. 2)
    HDU6583:Typewriter(dp+后缀自动机)
  • 原文地址:https://www.cnblogs.com/chutianyao/p/3305434.html
Copyright © 2011-2022 走看看