|
I want to write a webpage to a file and if I use: use IO::Socket; my $http_cmd = "GET /mytest.html HTTP/1.0\n\n"; my $run_cmd = `echo '$http_cmd'`; my $S = IO::Socket::INET->new( PeerAddr => $ARGV[0] || "localhost", PeerPort => $ARGV[1] || 80, Proto => "tcp", Type => SOCK_STREAM) or die $@; send $S, $run_cmd, 0 or die "send: $!\n"; shutdown $S, 1; sysread $S, $_, 1024, 0 or die "recv: $!\n"; @webpage=<$S>; print @webpage;
At this point I get the last part of the webpage (probably the last 1024 bytes). If I change the 1024 to 1, then it looks like I get the entire page in the array. Does this read 1024 bytes into $S? Do I have to do some type of a loop to get the entire stream? Why do I get the entire stream if I change it to 1 or 10?
Thanks,
Vickie Cooper
Vickie Cooper
|
- Re: Using IO::Socket Cooper, Vickie
- Re: Using IO::Socket Nick Ing-Simmons
