#! perl -slw use strict; { use IO::Socket::INET; my %socket = ( Host=>'www.perl.org', Port=>80, Proto=>'tcp', Timeout=>10, Type=>SOCK_STREAM ); my $socket = IO::Socket::INET->new(%socket) or die $!; print $socket; close $socket or die $!; print 'IO::Socket::INET closed'; } { use Socket; select STDOUT; print 'About to open socket'; socket(SH, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or die $!; print 'socket opened'; my $dest = sockaddr_in(80, inet_aton('www.perl.org')); connect(SH, $dest) or die $!; print 'connected'; select SH; $|=1; print SH 'GET / HTTP/1.0' . "\cM\cJ\cM\cJ" or die $!; select STDOUT; print 'sent'; print or die $!; print 'received'; } #### D:\Perl\test>test IO::Socket::INET=GLOB(0x1c19ce8) IO::Socket::INET closed About to open socket socket opened connected sent HTTP/1.1 200 OK Date: Thu, 24 Apr 2003 05:00:15 GMT Server: Apache/2.0.44-dev (Unix) DAV/2 Last-Modified: Wed, 16 Apr 2003 15:55:53 GMT ETag: "6fcce-3-95229440" Accept-Ranges: bytes Content-Length: 3 Connection: close Content-Type: text/html; charset=ISO-8859-1 x2 received