Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Telnet session disconnect testing

by arkturuz (Curate)
on Jan 13, 2010 at 16:10 UTC ( #817210=note: print w/ replies, xml ) Need Help??


in reply to Telnet session disconnect testing

First of all, a little comment on your code: I think there's no need to redefine subroutines inside the for loop all the time. You can move them out of it, unless you have some specific reason not to (on a quick glance, variable scoping ($_) could be an issue). On your problem: you say you have programmed reboots. If they happen at fixed hours, you could try not to connect to the service at that time. Also, instead of die() you could sleep() for some time, and then try reconnecting again.


Comment on Re: Telnet session disconnect testing
Select or Download Code
Re^2: Telnet session disconnect testing
by bajangerry (Novice) on Jan 13, 2010 at 16:32 UTC

    arkturuz,

    Not quite sure I understand your comment regarding the subroutines... I am not that great on Perl but thanks for the input. The problem with your suggestion is that I have provided others with this program to use http://simplesmdr.sourceforge.net so to hardcode a reboot time is not really an option here. Will look into the sleep() option though, thanks.
      Not quite sure I understand your comment regarding the subroutines

      Usually, you define your functions once, and rarely put them inside the loops (unless there's some tricky busines going on - like constantly defining new subroutines for some specific tasks). Nevertheless, if it's okay with you, and the program works as expected, then there's no problem. Although it's better for readabilly, maintenance, logic of the program, easier debugging, to do otherwise.

        Ok I see what you mean now, the for loop needs to be closed after the while loop closes.

        Made the change and everything works as before... not sure if this will resolved the problem with the link drop/reconnect issue though.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://817210]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-09-01 22:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (17 votes), past polls