ActiveState Powered by ActiveState

ActiveState Community


Can TCL spawn 2 telnet sessions and then allow issuing commands to each?

Posted by longisyard on 2007-10-22 16:18

Can TCL allowing spawning 2 telnet sessions to different switches then allow issuing command to each switch?

Below is the sample code:

spawn telnet $switch1_ipAddr
set spawn_switch1 $spawn_id
spawn telnet $switch2_ipAddr
set spawn_switch2 $spawn_id

set commandToSend "ls"
send -i $spawn_switch1 "$commandToSend\r"
send -i $spawn_switch2 "$commandToSend\r"

jeffh | Mon, 2007-10-22 18:00

Yes, you can have numerous telnet sessions running simultaneous. It is then important to keep track of the spawn_id and manage input from the in the 'expect' statement.

ramyalenin | Mon, 2008-02-18 04:59

What all can be the reasons for spawn telnet failure on a particular machine, while telnet is possible on that machine.

jeffh | Mon, 2008-02-18 11:38

You want to use the BSD telnet, as the Microsoft one has proved more problematic to control.

-->