You cannot start a Telnet session from Tcl shell

Recently, I've got a really interesting question: “If I start a telnet or SSH session from my Tcl shell with the exec command, I get the initial text, but then it all freezes. What's wrong?”

Let's start with the basic picture: When you open a telnet session to a router, the input and output is captured by the Exec process. When you open an outgoing telnet or SSH session to another router, the Exec process implements the telnet/ssh client functionality and switches the input/output data between the two TCP sessions:However, when you start the Tcl shell, the Exec CLI loses its control of the input/output streams, as they are taken over by Tclsh. The only means of communicating with the Exec CLI is through the typeahead and exec commands:So, if you start another Telnet session with the exec command, the Tclsh still controls the input/output of the user session and there is no way for the telnet client in the Exec CLI to communicate with the user.

This article is part of You've asked for it series.

1 comment:

  1. Hello,

    I want to get the running config of a remote router from a local router. How can I do with TCL ? I have searched many but can not find the solution.

    Any help will be highly appreciated !

    Nguyen Su Tam

    ReplyDelete

You don't have to log in to post a comment, but please do provide your real name/URL. Anonymous comments might get deleted.

Ivan Pepelnjak, CCIE#1354, is the chief technology advisor for NIL Data Communications. He has been designing and implementing large-scale data communications networks as well as teaching and writing books about advanced technologies since 1990. See his full profile, contact him or follow @ioshints on Twitter.