连接超时问题

jrhmpt01:/root/async# cat a2.pl 
use  LWP::UserAgent;
use utf8;
use DBI;
use POSIX;
use HTTP::Date qw(time2iso str2time time2iso time2isoz);


my $ua = LWP::UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->agent("Mozilla/8.0");


$time1=time2iso(time());
print "\$time1 is $time1\n";
my $response = $ua->get('https://wenjinbao.winfae.com/');
if ($response->is_success) {
print   $response->decoded_content;  # or whatever
}else{print   $response->decoded_content; };
$time2=time2iso(time());
print "\$time2 is $time2\n";
print "111111111111111111111111111111111111\n";
jrhmpt01:/root/async# perl a2.pl 
$time1 is 2016-04-16 19:35:30
500 Can't connect to wenjinbao.winfae.com:443 (connect: Connection timed out)
$time2 is 2016-04-16 19:35:33
111111111111111111111111111111111111

posted @ 2016-04-16 19:36  czcb  阅读(158)  评论(0编辑  收藏  举报