����JFIF��H�H����Exif��MM�*���� ��3����V�����3������3�(��������������������3�����
Server IP : 74.208.127.88 / Your IP : 3.147.43.250 Web Server : Apache/2.4.41 (Ubuntu) System : Linux ubuntu 5.4.0-163-generic #180-Ubuntu SMP Tue Sep 5 13:21:23 UTC 2023 x86_64 User : www-data ( 33) PHP Version : 7.4.3-4ubuntu2.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/netcat-openbsd/examples/contrib/ |
Upload File : |
#! /bin/bash # script to measure the speed of netcat. # start with one argument for usage information # # Tools that are used by this script are: # nc, bc, wc, sed, awk # # Author: Karsten Priegnitz (koem@petoria.de) NCPORT=23457 WAIT=1 # determine the programme's name me=`echo $0 | sed 's+.*/++'` # check number of arguments provided if [ $# -ne 0 -a $# -ne 2 ]; then echo "Usage:" echo echo " On the transmitter side:" echo " $me <receivers ip-address> <amount of data>" echo echo " The <amount of data> is to be given in byte but you" echo " also can supply M or K for MegaByte and KiloByte." echo " Example: $me 10.1.1.3 20M" echo echo " On the receiver side:" echo " $me" echo echo " Start $me on the receiver side before starting it" echo " on the transmitter side. Stop the receiver by pressing" echo " and holding Ctrl-C." exit 1 fi # are we the receiver? if [ $# -eq 0 ]; then # yes, we are while true; do echo "waiting to receive data... (quit: press and hold Ctrl-C)" # wait for data and count bytes AMOUNT=`nc -v -w 120 -l -p $NCPORT | wc -c | awk '{print $1}'` # display amount of data received echo $AMOUNT byte of data received echo # sleep, so that the loop can be # interrupted by pressing Ctrl-C sleep 1 done fi # we are the sender echo "sending data..." # calculate the amount of data to be sent AMOUNT=`echo $2|sed s/[mM]/\*1048576/g | sed s/[kK]/\*1024/g | bc` # send data and measure the time spent TEMP=/tmp/$me.tx ( time -p dd if=/dev/zero bs=$AMOUNT count=1 2>/dev/null | nc -v -w $WAIT $1 $NCPORT ) 2>"$TEMP" || cat "$TEMP" # read the time needed REAL=`grep "^real" "$TEMP" | awk '{print $2}'` rm "$TEMP" # subtract the wait times DOUBLEWAIT=$(($WAIT * 2)) NEEDED=`echo $REAL - $DOUBLEWAIT|bc` # calculate and print speed BPS=`echo "scale=3;$AMOUNT / $NEEDED"|bc` KBPS=`echo "scale=3;$AMOUNT / $NEEDED / 1024"|bc` MBPS=`echo "scale=3;$AMOUNT / $NEEDED / 1048576"|bc` echo "time needed: ${NEEDED}s" echo "byte per second: $BPS" echo "KByte per second: $KBPS" echo "MByte per second: $MBPS"