I.MX6 Android iperf3 porting failed

/*****************************************************************************
 *                    I.MX6 Android iperf3 porting failed
 * 说明:
 *     本来想移植一下iperf3到Android系统上测试一下网卡,可能是版本高了点,最后
 * 运行客户端的时候会报错,也找了一些解决办法,但还是未能解决。
 *
 *                                          2016-4-5 深圳 南山平山村 曾剑锋
 ****************************************************************************/

一、参考文档:
    1. sys/fcntl.h : no such file while cross compiling pcsclite for Android?
        http://stackoverflow.com/questions/12384353/sys-fcntl-h-no-such-file-while-cross-compiling-pcsclite-for-android
    2. Iperf for Android-4.1 移植
        http://blog.chinaunix.net/uid-24410388-id-3669153.html
    3. unable to create a new stream: No such file or directory
        https://github.com/esnet/iperf/issues/374
    4. How to compile iperf3 for Windows
        http://www.embeddedsystemtesting.com/2014/08/how-to-compile-iperf3-for-windows.html

二、download:
    url: https://github.com/esnet/iperf

三、解决缺少头文件的问题:
    由于直接编译Android shell程序的时候会出现缺少.h文件,于是先执行下面这行代码,貌似可以解决头文件的问题:
           ./configure --host=arm-none-linux-gnueabi CXX=arm-none-linux-gnueabi-g++ CXXFLAGS=-static CC=arm-none-linux-gnueabi-gcc CFLAGS=-static

四、get .c file
    zengjf@zengjf:~/ipref/iperf-master/src$ ls -al *.c | awk '{print $9}' | sed -e "s/^/src\//" -e "s/$/\\\/"
    src/cjson.c\
    src/iperf_api.c\
    src/iperf_client_api.c\
    src/iperf_error.c\
    src/iperf_locale.c\
    src/iperf_sctp.c\
    src/iperf_server_api.c\
    src/iperf_tcp.c\
    src/iperf_udp.c\
    src/iperf_util.c\
    src/main.c\
    src/net.c\
    src/tcp_info.c\
    src/tcp_window_size.c\
    src/timer.c\
    src/t_timer.c\
    src/t_units.c\
    src/t_uuid.c\
    src/units.c\
    zengjf@zengjf:~/ipref/iperf-master/src$ 

五、compile for Android:
    cat Android.mk
        # external/i2c-tools/Android.mk
        LOCAL_PATH:= $(call my-dir)
        include $(CLEAR_VARS)

        LOCAL_SRC_FILES += \
        src/cjson.c\
        src/iperf_api.c\
        src/iperf_client_api.c\
        src/iperf_error.c\
        src/iperf_locale.c\
        src/iperf_sctp.c\
        src/iperf_server_api.c\
        src/iperf_tcp.c\
        src/iperf_udp.c\
        src/iperf_util.c\
        src/main.c\
        src/net.c\
        src/tcp_info.c\
        src/tcp_window_size.c\
        src/timer.c\
        src/units.c\
        #src/t_timer.c\            # 这里有main函数,需要另外写可执行脚本
        #src/t_units.c\            # 这里有main函数,需要另外写可执行脚本
        #src/t_uuid.c\            # 这里有main函数,需要另外写可执行脚本

        LOCAL_C_INCLUDES +=       \
            $(LOCAL_PATH)         \
            $(LOCAL_PATH)/include \
            $(LOCAL_PATH)/src

        LOCAL_CFLAGS  +=  -O2
        LOCAL_CFLAGS += -DHAVE_CONFIG_H

        LOCAL_LDLIBS           += -lpthread

        LOCAL_SHARED_LIBRARIES := libc libm libcutils libnetutils

        LOCAL_MODULE := iperf

        #LOCAL_FORCE_STATIC_EXECUTABLE := true
        LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
        #LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)
        #LOCAL_MODULE_TAGS := eng user

        include $(BUILD_EXECUTABLE)

六、编译结果:
    ......
    target thumb C: iperf <= /home/zengjf/c_program/ipref/iperf-master/src/cjson.c
    target Executable: iperf (out/target/product/sabresd_6dq/obj/EXECUTABLES/iperf_intermediates/LINKED/iperf)
    target Symbolic: iperf (out/target/product/sabresd_6dq/symbols/system/xbin/iperf)
    target Strip: iperf (out/target/product/sabresd_6dq/obj/EXECUTABLES/iperf_intermediates/iperf)
    Install: out/target/product/sabresd_6dq/system/xbin/iperf
    make: Leaving directory `/home/zengjf/myandroid'
    zengjf@zengjf:~/myandroid$ 

七、执行效果:
    1. root@android:/data/local # ./iperf
        iperf3: parameter error - must either be a client (-c) or server (-s)

        Usage: iperf [-s|-c host] [options]
               iperf [-h|--help] [-v|--version]

        Server or Client:
          -p, --port      #         server port to listen on/connect to
          -f, --format    [kmgKMG]  format to report: Kbits, Mbits, KBytes, MBytes
          -i, --interval  #         seconds between periodic bandwidth reports
          -F, --file name           xmit/recv the specified file
          -A, --affinity n/n,m      set CPU affinity
          -B, --bind      <host>    bind to a specific interface
          -V, --verbose             more detailed output
          -J, --json                output in JSON format
          --logfile f               send output to a log file
          --forceflush              force flushing output at every interval
          -d, --debug               emit debugging output
          -v, --version             show version information and quit
          -h, --help                show this message and quit
        Server specific:
          -s, --server              run in server mode
          -D, --daemon              run the server as a daemon
          -I, --pidfile file        write PID file
          -1, --one-off             handle one client connection then exit
        Client specific:
          -c, --client    <host>    run in client mode, connecting to <host>
          -u, --udp                 use UDP rather than TCP
          -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
                                    (default 1 Mbit/sec for UDP, unlimited for TCP)
                                    (optional slash and packet count for burst mode)
          -t, --time      #         time in seconds to transmit for (default 10 secs)
          -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)
          -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)
          -l, --len       #[KMG]    length of buffer to read or write
                                    (default 128 KB for TCP, 8 KB for UDP)
          --cport         <port>    bind to a specific client port (TCP and UDP, default: ephemeral port)
          -P, --parallel  #         number of parallel client streams to run
          -R, --reverse             run in reverse mode (server sends, client receives)
          -w, --window    #[KMG]    set window size / socket buffer size
          -C, --congestion <algo>   set TCP congestion control algorithm (Linux and FreeBSD only)
          -M, --set-mss   #         set TCP/SCTP maximum segment size (MTU - 40 bytes)
          -N, --no-delay            set TCP/SCTP no delay, disabling Nagle's Algorithm
          -4, --version4            only use IPv4
          -6, --version6            only use IPv6
          -S, --tos N               set the IP 'type of service'
          -L, --flowlabel N         set the IPv6 flow label (only supported on Linux)
          -Z, --zerocopy            use a 'zero copy' method of sending data
          -O, --omit N              omit the first n seconds
          -T, --title str           prefix every output line with this string
          --get-server-output       get results from server
          --udp-counters-64bit      use 64-bit counters in UDP test packets

        [KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

        iperf3 homepage at: http://software.es.net/iperf/
        Report bugs to:     https://github.com/esnet/iperf
        1|root@android:/data/local #
    2. root@android:/data/local # ./iperf -s &
        [1] 13511
        -----------------------------------------------------------
        Server listening on 5201
        -----------------------------------------------------------
        root@android:/data/local #
    3. root@android:/data/local # ./iperf -c 127.0.0.1 -i 1 -w 1M
        Connecting to host 127.0.0.1, port 5201
        iperf3: error - unable to create a new stream: No such file or directory
        Accepted connection from 127.0.0.1, port 49340
        iperf3: the client has unexpectedly closed the connection
        -----------------------------------------------------------
        Server listening on 5201
        -----------------------------------------------------------
        1|root@android:/data/local #
    4. 最后这部分出现的问题,没找到解决办法,虽然参考文章里面有人说能解决,但我自己尝试那么做了,未解决。

 

时间: 2024-09-20 12:23:36

I.MX6 Android iperf3 porting failed的相关文章

I.MX6 Android i2c-tools porting

/************************************************************************** * I.MX6 Android i2c-tools porting * 说明: * 判断I2C总线设备是否存在,每次都去查dmesg,实在是烦了,于是还是移植 * 一个i2c-tools比较好,不用翻那长长内核信息. * * 2016-3-31 深圳 南山平山村 曾剑锋 **************************************

I.MX6 Android can-utils 移植

/******************************************************************* * I.MX6 Android can-utils 移植 * 说明: * 由于最近要用到CAN,于是先移植一下can-tuils来看一下情况. * * 2016-8-1 深圳 南山平山村 曾剑锋 ******************************************************************/ 一.获取源码: https:/

I.MX6 android mkuserimg.sh

/************************************************************************** * I.MX6 android mkuserimg.sh * 说明: * 修改了android源代码中的一些内容之后,如果内容过多,不能确定到底修改 * 了system目录下的哪些文件,于是可能要重新make,但这实在是让人难以接受, * 因为等待的时间会很长,于是从make命令最后看到mkuserimg.sh是用来最后对文件 * 系统进行打包的

I.MX6 Ethernet UI patch failed

/*********************************************************************** * I.MX6 Ethernet UI patch failed * 说明: * 最近想要在I.MX6的Android上添加Ethernet UI界面,但是使用NXP提供的 * patch,结果失败了. * * 2016-4-21 深圳 南山平山村 曾剑锋 ************************************************

I.MX6 Android netperf

/***************************************************************************** * I.MX6 Android netperf * 说明: * 之前移植iperf3网络测试工具不成功,本来想再移植一个iperf2来试一下,但是 * 在检查Android源码系统的时候不小心看到netperf文件夹,查了点资料,貌似可以实 * 现iperf的功能,于是又省了点事. * * 2016-4-18 深圳 南山平山村 曾剑锋 **

I.MX6 Android frameworks services 文件架构

/******************************************************************************* * I.MX6 Android frameworks services 文件架构 * 说明: * 这部分内容后续可能需要多给一点注意力了,因为这部分在做系统移植的时候经常 * 需要通过这部分来进行调试. * 2016-3-19 深圳 南山平山村 曾剑锋 ******************************************

I.MX6 bq27441 driver porting

/************************************************************************** * I.MX6 bq27441 driver porting * 声明: * 本文主要记录bq27441电池检测芯片驱动遇到的一些问题以及解决方法. * * 2016-1-28 深圳 南山平山村 曾剑锋 ************************************************************************

异常-android:关于open failed: EACCES (Permission denied)

问题描述 android:关于open failed: EACCES (Permission denied) DownloadManager下载的东西位于内置sd卡的download文件夹下.下载完后,需要解压到外置sd卡的一个目录下.但是解压的时候,抛出异常open failed: EACCES (Permission denied). Manifest 已经添加权限 解决方案 文件系统的权限没有添加,不是应用的权限 解决方案二: 之前处理外置sdcard的时候没有出现权限问题,今天.....

android studio gradle failed问题

问题描述 android studio gradle failed问题 本人是安卓实习生一枚,遇到这个问题,求大神解答. Error:Unable to start the daemon process.This problem might be caused by incorrect configuration of the daemon.For example an unrecognized jvm option is used.Please refer to the user guide