EmbeddedRelated.com
Forums

exit command in telnet

Started by Bruce Varley February 14, 2012
I'm using telnet from a command prompt under WinXP to connect to an embedded 
linux target. Part of the target boot sequence involves initiating an exit 
from a startup shell, by entering 'exit <enter>'. Telnet interprets this as 
terminating the telnet session, the command window returns to a C: prompt. 
Is there a way that I can get the session to just pass the exit command 
through and hang in? TIA 


On 14/02/2012 08:31, Bruce Varley wrote:
> I'm using telnet from a command prompt under WinXP to connect to an embedded > linux target. Part of the target boot sequence involves initiating an exit > from a startup shell, by entering 'exit<enter>'. Telnet interprets this as > terminating the telnet session, the command window returns to a C: prompt. > Is there a way that I can get the session to just pass the exit command > through and hang in? TIA >
Like many of Window's command line programs, its telnet client is somewhat limited - have you tried alternative clients? If you have a Linux machine you can use that. On Windows you could try msys telnet client (I find Windows unusable until msys is installed to give proper command-line tools), or Tera Term Pro (which is an excellent serial terminal emulator, telnet client and ssh client), or perhaps Putty (also telnet and ssh). <http://www.mingw.org/wiki/MSYS> <http://ttssh2.sourceforge.jp/index.html.en> <http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html> I can't say for sure whether that will fix your problem - but if these /real/ telnet clients can't help you, nothing will (short of writing your own telnet client).
On Tue, 14 Feb 2012 15:31:17 +0800, "Bruce Varley" <bv@NoSpam.com>
wrote:

>I'm using telnet from a command prompt under WinXP to connect to an embedded >linux target. Part of the target boot sequence involves initiating an exit >from a startup shell, by entering 'exit <enter>'. Telnet interprets this as >terminating the telnet session, the command window returns to a C: prompt. >Is there a way that I can get the session to just pass the exit command >through and hang in? TIA
Like many command line telnet clients, if you specify the host on the command line, when the host disconnects, the default response is to terminate the telnet program as well. Some telnet clients allow you to override that behavior, but the one in Windows is fairly basic. OTOH, if you run it in command mode (just "telnet"), and then explicitly open the session ("o hostname"), after the host disconnects the telnet client will remain active, waiting for another command. But if your requirement is having the terminal session itself remain after the "exit", the problem is that it's actually being disconnected by the host. Some more sophisticated telnet clients support automatic logons, and automatic session reconnection, and others allow scripting (where you could reconnect the session after it disconnects).
On Tue, 14 Feb 2012 15:31:17 +0800, Bruce Varley scribbled:

> I'm using telnet from a command prompt under WinXP to connect to an > embedded linux target. Part of the target boot sequence involves > initiating an exit from a startup shell, by entering 'exit <enter>'. > Telnet interprets this as terminating the telnet session, the command > window returns to a C: prompt. Is there a way that I can get the session > to just pass the exit command through and hang in? TIA
I find, using the simple client provided by Microsoft, that if you DON'T specify the host name/IP address on the command line that an exit from the target does not cause the client to terminate. i.e. telnet then enter OPEN <hostname> <port> diddle as needed exit and you're back in the telnet client Regards --
>@<
Bill Dennen ieee1014@hotmail.com Of all the things I've lost, I miss my mind the most ...
"Bill Dennen" <ieee1014@hotmail.com> wrote in message
news:jhdroh$dmo$1@speranza.aioe.org...
> On Tue, 14 Feb 2012 15:31:17 +0800, Bruce Varley scribbled: > > > I'm using telnet from a command prompt under WinXP to connect to an > > embedded linux target. Part of the target boot sequence involves > > initiating an exit from a startup shell, by entering 'exit <enter>'. > > Telnet interprets this as terminating the telnet session, the command > > window returns to a C: prompt. Is there a way that I can get the session > > to just pass the exit command through and hang in? TIA > > I find, using the simple client provided by Microsoft, that if you DON'T > specify the host name/IP address on the command line that an exit from > the target does not cause the client to terminate. > > i.e. > telnet > then enter OPEN <hostname> <port> > diddle as needed > exit > and you're back in the telnet client
The Telnet client doesn't do zip with the 'exit' command but the host does: it terminates the connection, which in turn makes Telnet either exit or go back to its own command prompt, depending on how you invoked telnet as Bill says. Meindert