[ale] IO to a web site.

Christopher Fowler cfowler at outpostsentinel.com
Sun Nov 14 09:06:04 EST 2004


I'm trying to get a page, www.google.com/, using this simple perl
script.  I expected this to be more line by line basis but google is not
terminated the connection after the page is spit out.  Also I do not
seem to get the whole page and am stuck in the while loop.

I know I can use LWP but I'm first during straight I/O.  This is to see
if my select() idea is plausible when creating my proxy.

#!/usr/bin/perl
#
#

use IO::Socket::INET;
use IO::Handle;
use strict;


my $string = "GET / HTTP/1.1\r\n\r\n";

my $s = IO::Socket::INET->new(PeerAddr => 'www.google.com',
  PeerPort => 80, Proto => 'tcp') or die "$!\n";


print $s $string;
$s->flush();
while(<$s>) {
  print $_;
  STDOUT->flush();




More information about the Ale mailing list