tcp-banger.pl
上传用户:liugui
上传日期:2007-01-04
资源大小:822k
文件大小:1k
- #!/usr/local/bin/perl
- # tcp-banger.pl
- #
- # Duane Wessels, Dec 1995
- #
- # Usage: tcp-banger.pl [host [port]] < url-list
- #
- # Sends a continuous stream of HTTP proxy requests to a cache. Stdin is a
- # list of URLs to request. Run N of these at the same time to simulate a
- # heavy client load.
- #
- # NOTE: does not simulate "real-world" events such as aborted requests
- # (connections) and other network problems.
- $|=1;
- $host=(shift || 'localhost') ;
- $port=(shift || '3128') ;
- require 'sys/socket.ph';
- $sockaddr = 'S n a4 x8';
- ($name, $aliases, $proto) = getprotobyname("tcp");
- ($fqdn, $aliases, $type, $len, $thataddr) = gethostbyname($host);
- $thissock = pack($sockaddr, &AF_INET, 0, "