Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

using interact with TCP socket
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" user@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.



Report this thread to moderator Post Follow-up to this message
Old Post
Phil Freed
05-27-05 02:01 AM


Re: using interact with TCP socket
"Phil Freed" <clt505@freed.com> writes:

> 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" user@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 th
at
> I'm missing?  Is it simply the platform that I'm on?
>
> Thanks for any light you may be able to shed on this.

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

Report this thread to moderator Post Follow-up to this message
Old Post
Don Libes
06-01-05 01:59 AM


Re: using interact with TCP socket
On Tue, 31 May 2005, Don Libes wrote:

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

> 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

Report this thread to moderator Post Follow-up to this message
Old Post
Michael A. Cleverly
06-08-05 09:01 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Tcl archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:18 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.