From: hadi motamedi on
Dear All
I have an application to automate telnet to remote VxWorks node from
Windows machine. Can you please show me a simple .tcl code to
accomplish this?
Thank you in advance
From: Donal K. Fellows on
On 5 May, 06:35, hadi motamedi <motamed...(a)gmail.com> wrote:
> I have an application to automate telnet to remote VxWorks node from
> Windows machine. Can you please show me a simple .tcl code to
> accomplish this?

Doing this from Windows? Messy. You can't use telnet itself, since it
is not automatable on Win, even with the Expect package; the binary is
tagged specially to prevent attaching the automation tools Expect uses
internally. This means you need to either use plink.exe (http://
www.chiark.greenend.org.uk/~sgtatham/putty/download.html) in telnet
mode (but use ssh mode if you can; it's much more secure and you can
even set things up so that you use a cryptographic identity rather
than a password) or just connect directly with a [socket] to port 23
on that remote machine.

It might be easiest to use autoexpect on a Linux or Unix machine
(http://wiki.tcl.tk/1865) to write the script to log in and do
whatever it is that you need to do, and then copy the script across to
the Windows system and adjust it to use plink instead of telnet to
connect (look for the spawn line to see where to edit).

Donal.
From: hadi motamedi on
> It might be easiest to use autoexpect on a Linux or Unix machine
> (http://wiki.tcl.tk/1865) to write the script to log in and do
Thank you very much for these information. According to you , I tried
to write it on my Linux machine as the followings :
#autoexpect
#/usr/bin/expect
>set name 172.16.17.160
>spawn telnet $name
>set cmd1 command1
>send "$cmd1"
>set cmd2 logout
>send "$cmd2"
>exit
I run my script but I just see logging in and logging out from the
telnet session. Actually, I want to capture the output result of
issuing 'command1' on the remote node. Can you please let me know how
to modify my code to get the desired result?

From: Donald Arseneau on
On May 4, 10:35 pm, hadi motamedi <motamed...(a)gmail.com> wrote:
> I have an application to automate telnet to remote VxWorks node from
> Windows machine. Can you please show me a simple .tcl code to
> accomplish this?

I just ignore the telnet protocol and read/write to a socket at port
23. That is specifically used to send console commands to a vxworks
box (notably "reboot").

I can send the trivial procs, but pasting into google-groups will make
a mess of them.

D
From: Bruce on
hadi motamedi wrote:
>> It might be easiest to use autoexpect on a Linux or Unix machine
>> (http://wiki.tcl.tk/1865) to write the script to log in and do
> Thank you very much for these information. According to you , I tried
> to write it on my Linux machine as the followings :
> #autoexpect
> #/usr/bin/expect
>> set name 172.16.17.160
>> spawn telnet $name
>> set cmd1 command1
>> send "$cmd1"
>> set cmd2 logout
>> send "$cmd2"
>> exit
> I run my script but I just see logging in and logging out from the
> telnet session. Actually, I want to capture the output result of
> issuing 'command1' on the remote node. Can you please let me know how
> to modify my code to get the desired result?
>
use the "expect" command - that's the part that 'reads'
the output of the interaction.

Bruce
 | 
Pages: 1
Prev: pwg 1.5.3
Next: Tablelist bindings