Solved

LWP::Simple no timeout

Posted on 2011-02-22
2
670 Views
Last Modified: 2012-05-11
Hi, I'm trying to call a webservice through perl script's LWP::Simple. The webservice may take a long time to respond. I want to avoid timeout issue. Is there a way to set no timeout for LWP::Simple? Will the following work? Thanks! -Ming

while (my $fileid = <FILE>) {
        chomp $fileid;
       $ua->timeout(7200);
        my $html = get("http://myurl/cmWebServices/cmImport?fileID=$fileid");
        if ( ! defined $html ) {
            $errorLog->error("$fileid failed");
        } else {
            my $end = Time::HiRes::gettimeofday();
            my $logString = $fileid . "\t" . sprintf("%.4f\n", $end-$start);
            $infoLog->info($logString);
        }
    }
 
0
Comment
Question by:mybluegrass
2 Comments
 
LVL 8

Accepted Solution

by:
point_pleasant earned 250 total points
Comment Utility
That would work for 2 hours but your DNS server may time out well before then.  the issue is in

DNS Timeout in IO::Socket::INET
0
 
LVL 1

Author Comment

by:mybluegrass
Comment Utility
You are right. It's not perl problem. It's the backend tomcat server thread timeout. Thanks!
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now