Closing telnet connection gracefully from session mode itself without going to telnet prompt.
Posted
by
Kumar Alok
on Super User
See other posts from Super User
or by Kumar Alok
Published on 2010-06-28T08:37:56Z
Indexed on
2011/01/03
4:55 UTC
Read the original article
Hit count: 325
telnet
a normal telnet connection is like this:
telnet localhost 22 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. SSH-2.0-OpenSSH_4.2 ^] telnet> close Connection closed.
I want to close it from telnet session itself without coming to telnet prompt by pressing. My requirement is that if i press some control character from telnet session itself like CTRL+A so it will come out of session and close it automatically. something like this:
$ telnet localhost 22 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. SSH-2.0-OpenSSH_4.2 ^A Connection closed. $
I tried all the options given at the man page and tried to do some $HOME/.telnetrc file tests but couldn't achieve it, as telnetrc will execute all the commands written in it with the given host whenever a telnet to that host is done.
Can anyone help me in this, like how it can be achieved.
© Super User or respective owner