Link to home
Start Free TrialLog in
Avatar of Chris S
Chris SFlag for India

asked on

specifying timeout in GET request ?????????

A Webget Client

#!/usr/bin/perl -w
    use IO::Socket;
    unless (@ARGV > 1) { die "usage: $0 host document ..." }
    $host = shift(@ARGV);
    $EOL = "\015\012";
    $BLANK = $EOL x 2;
    foreach $document ( @ARGV ) {
        $remote = IO::Socket::INET->new( Proto     => "tcp",
                                         PeerAddr  => $host,
                                         PeerPort  => "http(80)",
                                        );
        unless ($remote) { die "cannot connect to http daemon on $host" }
        $remote->autoflush(1);
        print $remote "GET $document HTTP/1.0" . $BLANK;
        while ( <$remote> ) { print }
        close $remote;
    }


Using the above script I can get html documents ...


BUt suppose the document is say 2 MB and there is a server timeout . I dont want the script to wait endlessly..

I want to set the timeout of the GET request .. is it possible ..

The script should request the document and if it is not getting the document within the SET timeout it should come back from the routine

help

BTW using the above routine I am able to access

"www.yahoo.com" type of addressess but Im
NOT able to retrieve

"username.hypermart.net" kind of documents

is there a solution ?



chris

ASKER CERTIFIED SOLUTION
Avatar of jhurst
jhurst

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Chris S

ASKER

thanks