| |||
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.
| |||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |