CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Time out - how to?

 



candude
stranger

Mar 13, 2001, 2:42 PM

Post #1 of 3 (448 views)
Time out - how to? Can't Post

Please or please help me, I use this script to do a whois, but lately my network is too slow therefore the script just stumbles in one place.. and just stays there for hours. How do i put timeout into it, say 30 seconds, to retry if time out occures.

Here is the source for the script I use:
sub get_whois {
local($fqdn,$server) = @_;
local(@test,$sin,$len,$offset,$written,$buff,$myfqdn);
socket(SOCK, PF_INET, SOCK_STREAM, (getprotobyname('tcp'))[2]) ||
return ((""));
$sin = sockaddr_in(43, inet_aton($server));
connect(SOCK, $sin) || return ((""));
#Win32::Process::Wait(30000);
#print Win32::Process::Wait(30000);
$offset = 0;
$buff = $fqdn . "\r\n";
$len = length($buff);
while($len) {
$written = syswrite(SOCK,$buff,$len,$offset);
$len -= $written;
$offset += $written;
}

@test=<SOCK>;
close(SOCK);
return(@test);
}

Thanks very much!!!

Regards,
Alex



wickedxter
User

Mar 15, 2001, 7:23 PM

Post #2 of 3 (430 views)
Re: Time out - how to? [In reply to] Can't Post

have you tried using the sleep fuction?
sleep (30);



candude
stranger

Mar 26, 2001, 8:49 AM

Post #3 of 3 (411 views)
Re: Time out - how to? [In reply to] Can't Post

I know where it gets stucked:
@test=<SOCK>;

Any idea why? Do you know any other scripts for whois who do not get stucked?

Regards,
Alex

Regards,
Alex
Domains Bot

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives