GithubHelp home page GithubHelp logo

knightwhosayni / android-iperf Goto Github PK

View Code? Open in Web Editor NEW
102.0 2.0 33.0 2.88 MB

Pre-compiled iperf/iperf3 binaries for Android + Dockerfile with SDK and NDK for manual build

License: MIT License

Dockerfile 9.34% Makefile 20.33% M4 66.54% Shell 3.79%
iperf iperf3 android ndk docker executables

android-iperf's Introduction

android-iperf

Build Status GitHub license

Getting Started

What is iPerf / iPerf3 ?

iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. It supports tuning of various parameters related to timing, buffers and protocols (TCP, UDP, SCTP with IPv4 and IPv6). For each test it reports the bandwidth, loss, and other parameters. This is a new implementation that shares no code with the original iPerf and also is not backwards compatible. iPerf was orginally developed by NLANR/DAST. iPerf3 is principally developed by ESnet / Lawrence Berkeley National Laboratory. It is released under a three-clause BSD license.

https://iperf.fr/

Remark No iperf/iperf3 source codes are included in this repo

Supported versions

iPerf2

Version Release day Source Code Comments
2.0.5 2010-07-08 Source Code
2.0.10 2017-08-11 Source Code
2.0.11 2018-05-24 Source Code compiled w/o HAVE_AF_PACKET
2.0.12 2018-06-26 Source Code compiled w/o HAVE_AF_PACKET
2.0.13 2019-01-22 Source Code compiled w/o HAVE_AF_PACKET
2.1.3 2021-07-15 Source Code compiled w/o HAVE_AF_PACKET, HAVE_LINUX_UDP_H!
2.1.4 2021-08-19 Source Code compiled w/o HAVE_AF_PACKET, HAVE_LINUX_UDP_H, HAVE_TUNTAP_TUN, HAVE_TUNTAP_TAP!

iPerf3

Version Release day Source Code
3.1.6 2017-02-02 Source Code
3.1.7 2017-03-03 Source Code
3.2 2017-06-26 Source Code
3.2rc1 2017-06-19 Source Code
3.3 2017-10-30 Source Code
3.4 2018-02-12 Source Code
3.5 2018-02-28 Source Code
3.6 2018-06-22 Source Code
3.7 2019-06-20 Source Code
3.8 2020-06-08 Source Code
3.8.1 2020-06-10 Source Code
3.9 2020-08-17 Source Code
3.10 2021-05-26 Source Code
3.10.1 2021-06-02 Source Code

Download

Compiled iperf and iperf3 binaries using SDK 4333796 and NDK r19 for devices with Android 9.0+ (API level 28+) - Travis-CI Deployment.

ABI Binaries
arm64-v8a here
armeabi-v7a here
x86 here
x86_64 here

More about Application Binary Interface (ABI): https://developer.android.com/ndk/guides/abis

To get supported ABI by an Android device:

adb shell getprop ro.product.cpu.abilist

Build

Prerequisites

Docker

Running

  1. Clone this repo
  2. Build image from Dockerfile
docker build -t android-ndk:latest .
  1. Run container and fetch binaries
docker run -d --name android-ndk-container android-ndk
mkdir -p binaries
docker cp -a android-ndk-container:/tmp/libs binaries
docker stop android-ndk-container

Usage

Upload a binary file (with compatible ABI) to an Android device

adb push <LOCAL_PATH_TO_BINARY_FILE>/<BINARY_NAME> /data/local/tmp/<BINARY_NAME>
adb shell chmod 777 /data/local/tmp/<BINARY_NAME>

iperf

Set a default iperf

adb shell ln -s /data/local/tmp/<IPERF2_BINARY_NAME> iperf

Execute iperf

adb shell /data/local/tmp/iperf <IPERF_ARGUMENTS>

iperf3

Set a default iperf3

adb shell ln -s /data/local/tmp/<IPERF3_BINARY_NAME> iperf3

Execute iperf3

adb shell /data/local/tmp/iperf3 <IPERF_ARGUMENTS>

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

iPerf community - iperf.fr

android-iperf's People

Contributors

knightwhosayni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

android-iperf's Issues

Not getting output message with command "iperf3 -s" in Android

Pushed binary with adb and tried command "iperf3" working well but when did iperf3 -s" not getting output message like "server listening on 5001 port""

in linux same command displaying below output
"Server listening on 5201"

Tried all iperf3 binary version but same issue.

Build fails at iperf-2.0.11 on Windows 10

Currently recieving this error in the build process:

$ docker build -t android-ndk:latest .
[+] Building 17.9s (21/78)
 => [internal] load build definition from Dockerfile                                                                                                 0.0s 
 => => transferring dockerfile: 8.68kB                                                                                                               0.0s 
 => [internal] load .dockerignore                                                                                                                    0.0s 
 => => transferring context: 34B                                                                                                                     0.0s 
 => [internal] load metadata for docker.io/library/ubuntu:16.04                                                                                      5.7s 
 => [internal] load build context                                                                                                                    0.0s 
 => => transferring context: 2.27kB                                                                                                                  0.0s 
 => [ 1/74] FROM docker.io/library/ubuntu:16.04@sha256:0f71fa8d4d2d4292c3c617fda2b36f6dabe5c8b6e34c3dc5b0d17d4e704bd39c                              0.0s 
 => CACHED [ 2/74] RUN apt-get -y update -qq &&     apt-get -y upgrade -qq &&     apt-get -y install -qq make bash git unzip wget curl openjdk-8-jd  0.0s 
 => CACHED [ 3/74] RUN wget --no-check-certificate -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip &&     mkdir -p /opt/and  0.0s 
 => CACHED [ 4/74] RUN yes | sdkmanager --licenses > /dev/null &&     yes | sdkmanager "platforms;android-26" > /dev/null                            0.0s 
 => CACHED [ 5/74] RUN wget --no-check-certificate -q https://dl.google.com/android/repository/android-ndk-r19-linux-x86_64.zip &&     mkdir -p /op  0.0s 
 => CACHED [ 6/74] RUN mkdir -p /tmp/jni                                                                                                             0.0s 
 => CACHED [ 7/74] COPY /jni/Android.mk /tmp/jni                                                                                                     0.0s 
 => CACHED [ 8/74] COPY /jni/Application.mk /tmp/jni                                                                                                 0.0s 
 => CACHED [ 9/74] RUN cd /tmp &&     wget --no-check-certificate -q -O iperf-2.0.5.tar.gz https://iperf.fr/download/source/iperf-2.0.5-source.tar.  0.0s 
 => CACHED [10/74] COPY /iperf-2.0.5/Android.mk /tmp/iperf-2.0.5                                                                                     0.0s 
 => CACHED [11/74] RUN cd /tmp/iperf-2.0.5 &&     autoconf &&     ./configure                                                                        0.0s 
 => CACHED [12/74] RUN cd /tmp &&     wget --no-check-certificate -q https://astuteinternet.dl.sourceforge.net/project/iperf2/iperf-2.0.10.tar.gz &  0.0s 
 => CACHED [13/74] COPY /iperf-2.0.10/Android.mk /tmp/iperf-2.0.10                                                                                   0.0s 
 => CACHED [14/74] RUN cd /tmp/iperf-2.0.10 &&     autoconf &&     ./configure                                                                       0.0s 
 => [15/74] RUN cd /tmp &&     wget --no-check-certificate -q https://astuteinternet.dl.sourceforge.net/project/iperf2/iperf-2.0.11.tar.gz &&     t  5.8s 
 => [16/74] COPY /iperf-2.0.11/* /tmp/iperf-2.0.11/                                                                                                  0.0s 
 => ERROR [17/74] RUN cd /tmp/iperf-2.0.11 &&     autoconf &&     ./configure                                                                        6.2s 
------
 > [17/74] RUN cd /tmp/iperf-2.0.11 &&     autoconf &&     ./configure:
#21 0.975 checking for a BSD-compatible install... /usr/bin/install -c
#21 0.983 checking whether build environment is sane... yes
#21 0.997 checking for a thread-safe mkdir -p... /bin/mkdir -p
#21 1.000 checking for gawk... no
#21 1.001 checking for mawk... mawk
#21 1.002 checking whether make sets $(MAKE)... yes
#21 1.016 checking whether make supports nested variables... yes
#21 1.028 checking whether to enable maintainer-specific portions of Makefiles... no
#21 1.029 checking for g++... g++
#21 1.056 checking whether the C++ compiler works... yes
#21 1.093 checking for C++ compiler default output file name... a.out
#21 1.095 checking for suffix of executables...
#21 1.140 checking whether we are cross compiling... no
#21 1.183 checking for suffix of object files... o
#21 1.201 checking whether we are using the GNU C++ compiler... yes
#21 1.215 checking whether g++ accepts -g... yes
#21 1.239 checking for style of include used by make... GNU
#21 1.247 checking dependency style of g++... gcc3
#21 1.287 checking for gcc... gcc
#21 1.313 checking whether we are using the GNU C compiler... yes
#21 1.335 checking whether gcc accepts -g... yes
#21 1.359 checking for gcc option to accept ISO C89... none needed
#21 1.396 checking whether gcc understands -c and -o together... yes
#21 1.434 checking dependency style of gcc... gcc3
#21 1.483 checking for library containing strerror... none required
#21 1.533 checking whether make sets $(MAKE)... (cached) yes
#21 1.536 checking for ranlib... ranlib
#21 1.552 checking build system type... x86_64-unknown-linux-gnu
#21 1.607 checking host system type... x86_64-unknown-linux-gnu
#21 1.607 checking for clock_gettime in -lrt... yes
#21 1.649 checking for the pthreads library -lpthreads... no
#21 1.694 checking whether pthreads work without any flags... no
#21 1.742 checking whether pthreads work with -Kthread... no
#21 1.752 checking whether pthreads work with -kthread... no
#21 1.764 checking for the pthreads library -llthread... no
#21 1.812 checking whether pthreads work with -pthread... yes
#21 1.859 checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
#21 1.900 checking if more special flags are required for pthreads... no
#21 1.900 checking for cc_r... gcc
#21 1.900 checking for library containing gethostbyname... none required
#21 1.939 checking for library containing socket... none required
#21 1.974 checking how to run the C preprocessor... gcc -E
#21 2.040 checking for grep that handles long lines and -e... /bin/grep
#21 2.043 checking for egrep... /bin/grep -E
#21 2.045 checking for ANSI C header files... yes
#21 2.134 checking for sys/types.h... yes
#21 2.164 checking for sys/stat.h... yes
#21 2.199 checking for stdlib.h... yes
#21 2.226 checking for string.h... yes
#21 2.258 checking for memory.h... yes
#21 2.290 checking for strings.h... yes
#21 2.325 checking for inttypes.h... yes
#21 2.357 checking for stdint.h... yes
#21 2.395 checking for unistd.h... yes
#21 2.435 checking arpa/inet.h usability... yes
#21 2.463 checking arpa/inet.h presence... yes
#21 2.474 checking for arpa/inet.h... yes
#21 2.485 checking libintl.h usability... yes
#21 2.514 checking libintl.h presence... yes
#21 2.525 checking for libintl.h... yes
#21 2.536 checking net/ethernet.h usability... yes
#21 2.565 checking net/ethernet.h presence... yes
#21 2.580 checking for net/ethernet.h... yes
#21 2.590 checking linux/ip.h usability... yes
#21 2.623 checking linux/ip.h presence... yes
#21 2.631 checking for linux/ip.h... yes
#21 2.638 checking linux/udp.h usability... yes
#21 2.664 checking linux/udp.h presence... yes
#21 2.672 checking for linux/udp.h... yes
#21 2.680 checking linux/if_packet.h usability... yes
#21 2.712 checking linux/if_packet.h presence... yes
#21 2.724 checking for linux/if_packet.h... yes
#21 2.733 checking linux/filter.h usability... yes
#21 2.760 checking linux/filter.h presence... yes
#21 2.767 checking for linux/filter.h... yes
#21 2.775 checking netdb.h usability... yes
#21 2.809 checking netdb.h presence... yes
#21 2.822 checking for netdb.h... yes
#21 2.832 checking netinet/in.h usability... yes
#21 2.864 checking netinet/in.h presence... yes
#21 2.877 checking for netinet/in.h... yes
#21 2.886 checking for stdlib.h... (cached) yes
#21 2.894 checking for string.h... (cached) yes
#21 2.901 checking for strings.h... (cached) yes
#21 2.910 checking sys/socket.h usability... yes
#21 2.942 checking sys/socket.h presence... yes
#21 2.955 checking for sys/socket.h... yes
#21 2.962 checking sys/time.h usability... yes
#21 2.985 checking sys/time.h presence... yes
#21 2.995 checking for sys/time.h... yes
#21 3.006 checking syslog.h usability... yes
#21 3.039 checking syslog.h presence... yes
#21 3.050 checking for syslog.h... yes
#21 3.059 checking for unistd.h... (cached) yes
#21 3.068 checking signal.h usability... yes
#21 3.096 checking signal.h presence... yes
#21 3.106 checking for signal.h... yes
#21 3.119 checking ifaddrs.h usability... yes
#21 3.153 checking ifaddrs.h presence... yes
#21 3.163 checking for ifaddrs.h... yes
#21 3.169 checking for an ANSI C-conforming const... yes
#21 3.192 checking for size_t... yes
#21 3.247 checking for ssize_t... yes
#21 3.315 checking whether time.h and sys/time.h may both be included... yes
#21 3.339 checking whether struct tm is in sys/time.h or time.h... time.h
#21 3.360 checking for stdint types... stdint.h (shortcircuit)
#21 3.386 make use of stdint.h in include/iperf-int.h (assuming C99 compatible system)
#21 3.386 checking 3rd argument of accept... socklen_t
#21 3.428 checking for pid_t... yes
#21 3.481 checking vfork.h usability... no
#21 3.518 checking vfork.h presence... no
#21 3.532 checking for vfork.h... no
#21 3.536 checking for fork... yes
#21 3.584 checking for vfork... yes
#21 3.627 checking for working fork... yes
#21 3.681 checking for working vfork... (cached) yes
#21 3.682 checking for working memcmp... yes
#21 3.748 checking sys/select.h usability... yes
#21 3.784 checking sys/select.h presence... yes
#21 3.799 checking for sys/select.h... yes
#21 3.810 checking for sys/socket.h... (cached) yes
#21 3.816 checking types of arguments for select... int,fd_set *,struct timeval *
#21 3.858 checking return type of signal handlers... void
#21 3.881 checking for strftime... yes
#21 3.924 checking for vprintf... yes
#21 3.966 checking for _doprnt... no
#21 4.018 checking for atexit... yes
#21 4.070 checking for memset... yes
#21 4.136 checking for pthread_cancel... no
#21 4.181 checking for select... yes
#21 4.232 checking for strchr... yes
#21 4.278 checking for strerror... yes
#21 4.315 checking for strtol... yes
#21 4.361 checking for strtoll... yes
#21 4.409 checking for usleep... yes
#21 4.452 checking for clock_gettime... yes
#21 4.496 checking for sched_setscheduler... yes
#21 4.536 checking for mlockall... yes
#21 4.591 checking for setitimer... yes
#21 4.647 checking for nanosleep... yes
#21 4.700 checking for snprintf... yes
#21 4.757 checking for inet_pton... yes
#21 4.796 checking for inet_ntop... yes
#21 4.838 checking for gettimeofday... yes
#21 4.878 checking whether ENOBUFS is declared... yes
#21 4.915 checking whether EWOULDBLOCK is declared... yes
#21 4.948 checking whether SO_TIMESTAMP is declared... yes
#21 4.982 checking whether SO_SNDTIMEO is declared... yes
#21 5.019 checking whether CPU_SET is declared... yes
#21 5.051 checking whether SIGALRM is declared... yes
#21 5.076 checking for struct tcp_info.tcpi_total_retrans... yes
#21 5.101 checking for struct sockaddr_in.sin_len... no
#21 5.146 checking *printf() support for %lld... yes
#21 5.185 checking size of bool... 0
#21 5.216 checking if true is defined... yes
#21 5.238 checking whether byte ordering is bigendian... no
#21 5.292 checking for struct ip_mreq... yes
#21 5.381 checking whether IP_ADD_MEMBERSHIP is declared... yes
#21 5.420 checking for multicast support... yes
#21 5.421 checking for struct group_source_req... yes
#21 5.514 checking whether MCAST_JOIN_SOURCE_GROUP is declared... yes
#21 5.558 checking for multicast ssm support... yes
#21 5.560 checking for struct sockaddr_storage... yes
#21 5.649 checking for struct sockaddr_in6... yes
#21 5.734 checking whether AF_INET6 is declared... yes
#21 5.792 checking for IPv6 headers and structures... yes
#21 5.792 checking for struct ipv6_mreq... yes
#21 5.879 checking whether IPV6_ADD_MEMBERSHIP is declared... yes
#21 5.936 checking whether IPV6_MULTICAST_HOPS is declared... yes
#21 5.978 checking for IPv6 multicast support... yes
#21 5.980 checking whether make is GNU make... yes
#21 6.004 checking that generated files are newer than configure... done
#21 6.005 configure: creating ./config.status
.in'6.121 config.status: error: cannot find input file: `Makefile
------
executor failed running [/bin/sh -c cd /tmp/iperf-2.0.11 &&     autoconf &&     ./configure]: exit code: 1

Cannot run program "/data/user/0/com.mhmm.iperf/files/iperf3": error=13, Permission denied

I used one of compiled binary file iperf3.9 and try to execute a command but it gaves permission denied all the time. i set the file also to executive. public static String runIperfCommand(String command) {
StringBuilder output = new StringBuilder();

    try {
        Process process = Runtime.getRuntime().exec(command);
        InputStream inputStream = process.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));

        String line;
        while ((line = reader.readLine()) != null) {
            output.append(line).append("\n");
        }

        process.waitFor();
    } catch (IOException | InterruptedException e) {
        Log.e("TAG123", "runIperfCommand: "+ e.getMessage() );
    }

    return output.toString();
}

Process process = new ProcessBuilder("chmod", "777", context.getFilesDir() + "/" + file.getName()).redirectErrorStream(true).start();
// Log the output of the chmod command
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
Log.d("TAG123", "chmod output: " + line);
}

                    int exitCode = process.waitFor();
                    if (exitCode == 0) {
                        // File is now executable
                        Log.i("TAG123", "copyAssetFileToInternalStorage: is executable");
                    } else {
                        // Handle the error
                        Log.e("TAG123", "copyAssetFileToInternalStorage: error");
                    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.