Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

using interact with TCP socket

9 views
Skip to first unread message

Phil Freed

unread,
May 26, 2005, 3:08:43 PM5/26/05
to
Platform: WinXP, cygwin

I have wrote a simple converter in Expect that is designed to take in a
telnet connection and pass it through to an SSH connection.

basically, the code is simple:

socket -server Server -myaddr 127.0.0.1 5555
vwait forever

And the Server routine (simplified to remove error checks and the like) is:

proc Server {channel clientAddr clientPort} {
spawn -open $channel
set telnet $spawn_id

spawn "/usr/bin/ssh" us...@domain.com
interact -u $telnet
}

This works fine, except that anything typed into my telnet session appears
on the screen twice. I've tried everything I can think of -- changing the
spawns to noecho, nottyinit & nottycopy, etc. Is this an artifact of
opening a TCP connection with "spawn -open"? Is there something simple that
I'm missing? Is it simply the platform that I'm on?

Thanks for any light you may be able to shed on this.


Don Libes

unread,
May 31, 2005, 5:02:55 PM5/31/05
to
"Phil Freed" <clt...@freed.com> writes:

If I understand your scenario (very cute by the way!), the extra echo
is being generated by your telnet client itself. You didn't show you
are using a telnet client in the scenario but I assume that's what
you're using, yes? The telnet client has a property of echoing by
default if used to any non-telnetd port.

Off the top of my head, I forget the option to turn off echoing, but
you can find it in any telnet documentation. However, telnet also
uses a very crude line mode (which is why echoing is kinda important).
Depending on your requirements, you might want to deal with that too.

Don

Michael A. Cleverly

unread,
Jun 8, 2005, 1:25:15 AM6/8/05
to
On Tue, 31 May 2005, Don Libes wrote:

> "Phil Freed" <clt...@freed.com> writes:

>> This works fine, except that anything typed into my telnet session appears
>> on the screen twice. I've tried everything I can think of -- changing the
>> spawns to noecho, nottyinit & nottycopy, etc. Is this an artifact of
>> opening a TCP connection with "spawn -open"? Is there something simple that
>> I'm missing? Is it simply the platform that I'm on?

> Off the top of my head, I forget the option to turn off echoing, but


> you can find it in any telnet documentation. However, telnet also
> uses a very crude line mode (which is why echoing is kinda important).
> Depending on your requirements, you might want to deal with that too.

The OP could try doing a:

puts [format %c%c%c 255 251 1]

to output the escape code to tell (a proper) telnet client to turn off
echo. For reference, you could (request to) turn it back on with:

puts [format %c%c%c 255 252 1]

Michael

0 new messages