icp-test.pl
上传用户:liugui
上传日期:2007-01-04
资源大小:822k
文件大小:3k
- #!/usr/local/bin/perl
- # icp-test.pl
- #
- # Duane Wessels, Nov 1996
- #
- # Usage: icp-test.pl host:port ... < url-list
- #
- # Sends a continuous stream of ICP queries to a set of caches. Stdin is
- # a list of URLs to request.
- require 'getopts.pl';
- $|=1;
- &Getopts('n');
- # just copy this from src/proto.c
- @CODES=(
- "ICP_INVALID",
- "ICP_QUERY",
- "UDP_HIT",
- "UDP_MISS",
- "ICP_ERR",
- "ICP_SEND",
- "ICP_SENDA",
- "ICP_DATABEG",
- "ICP_DATA",
- "ICP_DATAEND",
- "ICP_SECHO",
- "ICP_DECHO",
- "ICP_OP_UNUSED0",
- "ICP_OP_UNUSED1",
- "ICP_OP_UNUSED2",
- "ICP_OP_UNUSED3",
- "ICP_OP_UNUSED4",
- "ICP_OP_UNUSED5",
- "ICP_OP_UNUSED6",
- "ICP_OP_UNUSED7",
- "ICP_OP_UNUSED8",
- "UDP_RELOADING",
- "UDP_DENIED",
- "UDP_HIT_OBJ",
- "ICP_END"
- );
- require 'sys/socket.ph';
- $sockaddr = 'S n a4 x8';
- ($name, $aliases, $proto) = getprotobyname("udp");
- $thissock = pack($sockaddr, &AF_INET, 0, "