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 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
telnet and ssh login simaltaniously in expect

Posted by pgpatel (pgpatel), 16 August 2005
hi .....
i have one question.....
i want to remote login using telnet ans ssh in two different server....and want to do some things....
first i want to do tenet with one server.....then after i want to login with ssh to another server.....again i want to see some result in first server....again in second how can i maintain two login simaltaneously.....
i can spawn two different processes and and using spawn_id i can do this...but i donot have much idea....can u suggest me please.....? please give me some example code....

Posted by admin (Graham Ellis), 16 August 2005
There are examples under our "Expect Processes" resource at

Posted by pgpatel (pgpatel), 19 August 2005
Thanks for reply....
I saw the example...i didnot get what exactly i want(may be i didnot understand)
I want to do first telnet login then ssh login...i want to continue some execution on ssh login in background and at the same time i again want to send some command to first telnet can i do this ?
Thanking you

Posted by admin (Graham Ellis), 20 August 2005
The thing about teaching examples is that they never do exactly what you want - you need to learn from them and adapt them.

You want to:
a) spawn a process and save its spawn_id
b) spawn the second process and save its spawn_id

Then when you want to send or expect from the first process, you can restore its spawn_id, and when you want to send or expect from the second process you can restore its spawn_id.

as an ALTERNATIVE to this last step, you can use the -i option on expect to tell in which processes (in a list if you wish) to expect from.

Hope that clarifies it ... the examples show some of these things, and your course notes (if you or a colleague have been on one of our courses) will give you a lot better / fuller description.

This page is a thread posted to the opentalk forum at 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., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho