in reply to Telnet extract output

I believe you have misdiagnosed your problem. Your most likely problem is that you are issuing a directory name as a command expecting to move to that directory, and you're not seeing that the telnet session is complaining that that is a directory, not a file.

Try modifying your commands to things like $code->cmd('cd /log'); and see if your problems go away. If they don't then I highly recommend trying to echo the results of the telnet session to screen while you're trying to debug it.

I would also suggest that you try to add in some error handling logic if you're getting responses other than what you're expecting. Be warned that error handling logic is notoriously hard to add when manipulating programs remotely like this, and that is likely to be a source of future problems. But at least by trying to add some checks now you can ease many of your future headaches.

Replies are listed 'Best First'.
Re^2: Telnet extract output
by ScOut3R (Sexton) on Aug 01, 2008 at 06:17 UTC
    In the MikrotikOS telnet session you can change directory just typing the path, without any commands. I can see the session in the dump.log file and my problem is exactly what i said before. :(
      Does your prompt match the actual prompt?

      Could your prompt possibly match some data somewhere in the logs? That would cause it to think output has stopped when it hasn't.

      Make your prompt the most restrictive thing that you can. If you can, it may help to issue a command to change your prompt to something you're sure is not in the logs (setting the PS1 environment variable does it in bash) and setting your prompt to the new prompt.

        Nope it didn't match anything in the log output. I've set it as restrictive as i can. If i use the ^ and $ metacharacters then the situation just get worse because of command timeout. I think i have to figure it out, because the problem is clearly with the prompt variable.