#!/usr/local/bin/perl # usage: gettrace.pl filename $filename=$ARGV[0]; $them = "moat.nlanr.net"; $port = "80"; $pf_inet = 2; $sock_stream = 1; # change to $sock_stream=2; on SGI/Irix $tcp_proto = 6; $sockaddr = 'S n a4 x8'; chop($hostname = `hostname`); ($name, $aliases, $type, $len, $thisaddr) = gethostbyname($hostname); ($name, $aliases, $type, $len, $thataddr) = gethostbyname($them); $this = pack($sockaddr, 2, 0, $thisaddr); $that = pack($sockaddr, 2, $port, $thataddr); socket(S, $pf_inet, $sock_stream, $tcp_proto) || die "socket: $!"; bind(S, $this) || die "bind: $!"; connect(S, $that) || die "connect: $!"; select(S); $| = 1; select(stdout); $| = 1; print S "GET /Traces/Traces/$filename\n"; while($l=read(S,$byte,65536)){syswrite(stdout,$byte,$l);}