in reply to How to disable timeout in Net::Telnet

Update 2: Ok, I just tried the following, where "dir" will hang at a "more" prompt:
use Net::Telnet ; my $telnetSession = new Net::Telnet (Timeout => undef, Prompt => '/\>/ +') ; $telnetSession->open("10.0.0.1") ; $telnetSession->login("administrator", "password") ; my @DirInfo = $telnetSession->cmd("dir") ;
The only thing changed from the code I ran is the IP and the User and pass and it is still hung (5+ minutes). This is on Win2K with ActiveState's v5.6.1 build 629.

So it looks like the desired behavior is working for me.

Update 3: Ah, it just timed out...from the other side! Are you sure it's Net::Telnet and not the responder that is timing it out? (and yes my sniffer confirmed it :)

I looked through the timout methods in the module, and it appears to require a numeric timout, undef is treated like you did not specify anything and hence defaults to 10 seconds.

My other suggestion is to crank the timout up to the max seconds you could ever imagine the data retrieval to take, add a 1 minute buffer, and use that.

I would also recomend setting the timeout right before the command and then resetting it right after.

Update: A second look tells me that undef should be valid! I'm looking into this further.

"Nothing is sure but death and taxes" I say combine the two and its death to all taxes!

Replies are listed 'Best First'.
Re: Re: How to disable timeout in Net::Telnet
by Marza (Vicar) on Jun 17, 2002 at 22:18 UTC

    Which module? Unless the doc is wrong this is what was said from the Net-Telnet 3.02. Section on timeout

    If $secs is 0 then time-out occurs if the data cannot be immediately read or written. Use the undefined value to turn off timing-out.

    However, maximizing the seconds would have been my suggestion if I saw this in time ;)

Re: Re: How to disable timeout in Net::Telnet
by sksridevnair (Initiate) on Jun 18, 2002 at 09:25 UTC
    Yes, Ok I got a bit now. It is not the Net::Telnet, its the server that is timing-out the telnet session before the process is completed.How do I over come this problem of server timing out?Any help? Thank you very much. Sridev