Solved

LWP::Simple no timeout

Posted on 2011-02-22
2
695 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
ID: 34961260
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
ID: 34963966
You are right. It's not perl problem. It's the backend tomcat server thread timeout. Thanks!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Perl script to parse log and delete the file 17 173
Perl 101 11 76
PHP equivalent of opening a com object 5 83
Regular Expression for URL 10 96
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

815 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

13 Experts available now in Live!

Get 1:1 Help Now