This queue is for tickets about the Net-Telnet CPAN distribution.

Report information
The Basics
Id:
111370
Status:
rejected
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
john_simpson [...] swajime.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Timeout not honored under Windows 7 Enterprise
Date: Fri, 22 Jan 2016 11:10:14 -0500
To: bug-Net-Telnet@rt.cpan.org
From: John Simpson <john_simpson@swajime.com>
I've posted this at http://perlmonks.org/?node_id=1153372 to see if I can get a quick fix or workaround.  The preliminary response by Corion is "On Windows, alarm() doesn't interrupt system calls, so that's maybe why the timeout isn't working properly."

-----

I'm having difficulty controlling the timeout when initializing a Net::Telnet session. I set Timeout to 1, I've also set -timeout to 1. However, the the constructor is taking between 20 and 30 seconds before it times out and returns to the code. I need to bring this down to 2 seconds or less. Is there any way to make this call abort if it is not successfull within 1 or 2 seconds?

Note that I am only having this problem in Windows. On the mac, the timeout works just fine.

OS: Windows 7 Enterprise Version 6.1 (Build 7601: Service Pack 1)

PERL: v5.16.3 built for MSWin32-x86-multi-thread

This is ActivePerl 5.16.3 Build 1604 according to Windows.

Here is the code to reproduce the problem:

#!/usr/bin/perl # use strict; use warnings; use Net::Telnet; my $host = '192.168.130.112'; # valid host that is offline my $port = 10001; print "DEBUG 1\n"; my $t = new Net::Telnet (Host => $host, Port => $port, Timeout => 1, # -timeout => 1, Prompt => '/Escape character is.+\n/', Rs => ' ', Ors => '', Binmode => 1, Telnetmode => 1, Errmode => 'return'); print "DEBUG 2\n"; if (!$t) { die "Failed to create telnet session\n"; }
Jim, Sorry I don't have much time for individual help. Yes connection timeout doesn't work for MS-Windows. There is no facility for it. This is documented in the Net::Telnet section "What To Know Before Using". I hope you found a solution to your problem. On Fri Jan 22 11:10:25 2016, john_simpson@swajime.com wrote:
Show quoted text
> I've posted this at http://perlmonks.org/?node_id=1153372 to see if I can > get a quick fix or workaround. The preliminary response by Corion is "On > Windows, alarm() doesn't interrupt system calls, so that's maybe why the > timeout isn't working properly." > > ----- > > I'm having difficulty controlling the timeout when initializing a > Net::Telnet session. I set Timeout to 1, I've also set -timeout to 1. > However, the the constructor is taking between 20 and 30 seconds before it > times out and returns to the code. I need to bring this down to 2 seconds > or less. Is there any way to make this call abort if it is not successfull > within 1 or 2 seconds? > > Note that I am only having this problem in Windows. On the mac, the timeout > works just fine. > > OS: Windows 7 Enterprise Version 6.1 (Build 7601: Service Pack 1) > > PERL: v5.16.3 built for MSWin32-x86-multi-thread > > This is ActivePerl 5.16.3 Build 1604 according to Windows. > > Here is the code to reproduce the problem: > > #!/usr/bin/perl > # > > use strict; > use warnings; > use Net::Telnet; > > my $host = '192.168.130.112'; # valid host that is offline > my $port = 10001; > > print "DEBUG 1\n"; > my $t = new Net::Telnet (Host => $host, > Port => $port, > Timeout => 1, > # -timeout => 1, > Prompt => '/Escape character is.+\n/', > Rs => ' ', > Ors => '', > Binmode => 1, > Telnetmode => 1, > Errmode => 'return'); > print "DEBUG 2\n"; > if (!$t) { > die "Failed to create telnet session\n"; > }


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.