Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
expect:   spawn telnet from unix to windows

Posted by johndo (johndo), 20 March 2003

Does anyone have any experience
running an expect script to spawn telnet,
from unix ( Solaris 7 ), to windows (NT), to invoke
an executable ?

 I was able to run a batch file, but not an
executable.   Then I tried to call the executable
from the batch file, which didn't work either.

John Doppert

Posted by admin (Graham Ellis), 20 March 2003
There shouldn't be a problem running an executable rather than a batch file - telnet deals with sequences of bytes sent and received over TCP port 23 and whether those sequences cause batch files or executables to run isn't relevant.

Question.  Can you run your executable via telnet from the Solaris box outside expect?  If you can, then you should be able to do so through expect.  If you cannot (if the executable calls up windows, or if the executable is hardcoded to the keyboard of the Windows box rather than STDIN for example) then you have other issues to solve outside expect.

Issues to look at if you CAN run the executable directly via telnet:
a) Are you getting your new line sequences right sometimes you need to use the \r (return) character and  at other times the \n (newline; linefeed) in your send and expects.
b) Do you have timing matters to consider?  An expect script is very much faster to react than a human operator; you should be careful to wait for the very last byte to be received before you do a send and you may even then want to wait a few milliseconds in some situations.

Other useful tools are log_user (leave it in default condition initially or switch back to default so that you can see where your expect / send sequence jams) and send_human and send -h to make your automated inputs mimic human habits even more closely.




This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho