View the Most Wanted LQ Wiki articles.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-11-2007, 12:38 PM   #1
Registered: Feb 2007
Location: /home
Distribution: Kubuntu and CentOS
Posts: 214

Rep: Reputation: 32
tcl/expect telnet spawns randomly close

Greetings all,

I'm just about at wits end. I have a series of expect scripts that telnet into windows and linux boxes. Most of the time these scripts will run fine, but every fourth or fifth run a telnet session will close with out warning. This behavior is unpredictable and inconsistent. It may happen in part of my script once and another part of script at another time. I'm getting a little desperate. I'm running wireshark & exp_internal to try and pinpoint the problem no luck.

any hints/advice/thoughts/questions would be appreciated.

feeling stumped.


here is an output example: ('@'s are part of the welcome banner after logging in)
expect: read eof
expect: set expect_out(spawn_id) "exp9"
expect: set expect_out(buffer) ".\r\n\r\n\r\n\r\n @@ @@ @@ @@@@@@ @@@ \r\n @@ @@
@@ @@ \r\n @@ @@ @@ @@ @@@@@@ @@ @@ \r\n @@ @@ @@@@@@ @@ @@@@@@@
@@ @@ @@ \r\n @@@@@@ @@
\r\n @@ @@ @@ @@@@@ @@@@@ @@@@@ @@@@@ @@ @@@@@ @@@@@ @@ @@ @@ @@ \r\n @@ @@@@@ @@ @@
@ @@ @@ \r\n @@ @@@@ @@@ @@ @@ @@ @@ @@@ @@ @@@ @@@@ @@ @@@@ @@@@ \r\n
\nConnection closed by foreign host.\r\r\n"
write() failed to write anything - will sleep(1) and retry...
send: sending "\r" to { exp9 send: spawn id exp9 not open
while executing
"send "\r""
(procedure "gleanPrompt" line 10)
invoked from within
"gleanPrompt $spawn_id"
(procedure "connectTelnet" line 56)
invoked from within
"connectTelnet $host"
invoked from within
"set telnetSpawnId [connectTelnet $host]"
(file "loadSettings.exp" line 47)
Old 05-12-2007, 11:25 AM   #2
Senior Member
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Would you be able to supply the script's code?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
expect (Tcl) question kristof_v Programming 2 01-24-2013 06:32 AM
TCL/expect - parent hangs when child dies Hewson Programming 1 03-27-2007 09:44 PM
telnet server not reliable for expect script powah Linux - Software 0 11-16-2005 12:07 PM
Installation of Expect 5.x tcl private headers Anarchon Linux - Software 0 07-08-2005 10:02 AM
TCL, Expect, for Rsync - Please Help dholingw Programming 2 02-08-2004 11:27 AM

All times are GMT -5. The time now is 12:41 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration