I'm using Windows XP Pro SP2 and Windows XP Home SP2 and results are different: the $ua->get( 'http://deadmachine/' ) method waits and waits until some other timeout (operating system default?) of around 20 seconds before giving up. The $ua->timeout(2) setting is ignored. Running the same code under Cygwin works fine but that doesn't do much good outside Cygwin.

Observations of other perl features not working in Win32 : Windows XP:

- fork() doesn't work, try using Win32::Process or Win32::Job for similar feature

- alarm() doesn't work, trying using Win32::Process w/ Wait(), or Win32::Job() with a time counter in &watch() function, or Win32::GUI::Timer although none of these is quite as detached and asynchronous as alarm()

- IO::Socket::INET { Blocking => 0 } (asynschronous network IO) doesn't work, by default all network IO in Win32 is blocking (synchronous) meaning a listening socket will hold up the entire application until input is received and connection closed or the socket timeout occures.

Oddly enough IO::Socket::INET { Timeout => whatever } is working in Windows XP and the socket goes away in the defined amount of timeout... somehow that timeout works but other timeouts such as LWP::UserAgent's don't.

Thanks,
Kurt


From: Brian Millham <[EMAIL PROTECTED]>
To: perl-win32-gui-users@lists.sourceforge.net
Subject: RE: [perl-win32-gui-users] no alarm() in Win32, any work-arounds?
Date: Tue, 31 May 2005 23:25:34 -0400

I've used LWP::UserAgent on W2K Pro and Advanced Server, and the timeout
seems to work fine for me.

I've also had success using alarm, but I was only testing to see if it
worked, not trying it as a sanity timer (which is what a timeout would be).

my $uagent = LWP::UserAgent->new;
$uagent->timeout(2);

my $response = $uagent->get ('http://192.168.0.1/default.html');
if (!$response->is_success) {
        print "uagent error: " . $response->status_line . "\n";
        return;
}

I hope this helps!


Brian Millham
This message traveled at least 44,000 miles to reach you!
Creator of the DW6000 Monitor
http://www.millham.net/dw6000
[EMAIL PROTECTED]
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kurt
G
Sent: Tuesday, May 31, 2005 1:07 PM
To: [EMAIL PROTECTED]; perl-win32-gui-users@lists.sourceforge.net
Subject: Re: [perl-win32-gui-users] no alarm() in Win32, any work-arounds?


I'm working on a simple network monitor that periodically checks HTTP
service on a list of machines. I'm using LWP::UserAgent which offers a
timeout setting but timeout is ignored in Win32, so attempting a connection
to dead machine makes your program wait (in blocking mode, no less, seems
non-blocking IO is not an option either) for up to a minute. I've tried
Win32::PingICMP to test the machine for upness before attempting an HTTP
connection but ICMP is blocked on some the machines being tested, and also
does not help if the machine is up but HTTP server is down.

Thanks,
Kurt


>
>What where you planning on using the alarm function for? I can think of a
>potential work around, but it would depend on what you were planning:)
>
>Cheers,
>
>jez.
>




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 0522-4, 05/31/2005
Tested on: 5/31/2005 6:52:20 PM
avast! is copyright (c) 2000-2003 ALWIL Software.
http://www.avast.com



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0522-5, 05/31/2005
Tested on: 5/31/2005 11:25:34 PM
avast! is copyright (c) 2000-2003 ALWIL Software.
http://www.avast.com






-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users



Reply via email to