However, my question is this... if I test this with a completely bogus HTTP address, data is returned as such:my $url = new URI( $myhttpAddress ); my $host = $url->host; my $port = $url->port || 80; my $path = $url->path || "/"; my $socket = IO::Socket::INET->new( PeerAddr => $host ,PeerPort => $port ,Proto => 'tcp' ,Type => SOCK_STREAM ); die "failed to establish socket\n" unless $socket; $socket->autoflush(1); print $socket "GET $path\n", "Host: $host\n\n"; $firstRec = <$socket>; if ( defined $firstRec ) { print "$firstRec\n"; while ( <$socket> ) { print "$_\n"; }; };
How can I test the socket-connection, w/o actually parsing the data returned for "404 Object Not Found"...? Is there any way to check a return-code somehow? I've tried various different things, but to no avail. Any help greatly appreciated,Server: Microsoft-IIS/5.0 Date: Tue, 21 Oct 2003 20:18:30 GMT Content-Length: 4040 Content-Type: text/html .... .... ....
In reply to IO::Socket error-checking by MatthewFrancis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |