Re: flush telnet input

From: John L (jl_at_lammtarra.notthisbit.fslife.co.uk)
Date: 07/19/05


Date: Tue, 19 Jul 2005 07:28:31 +0100


"Scott" <ssNO@SPAMaao.gov.au> wrote in message news:pan.2005.07.19.04.14.45.338221@SPAMaao.gov.au...
> Hi all,
>
> I wish to send a simple command via telnet such as:
>
> echo "my_command arg1 arg2" | telnet host port
>
> but I'm finding that my program running on $host:$port
> doesn't actually receive the command. (It only accept()s &
> close()s the connection.)
>
> I can solve my problem with a delay:
>
> (echo "my_command arg1 arg2" && sleep 1) | telnet host port
>
> However I don't really want to do that as sometimes I have
> multiple commands to send (& the time it takes to finish varies)
> & it is useful to me that control returns to my shell ASAP.
>
> I suspect that the telnet program is receiving a SIGPIPE
> before it is able to actually send out the commands.
>
> So, my question is:
>
> How can I get telnet to flush the commands before it closes
> the connection & returns control to my shell?
>
> Any info/pointers muchly appreciated.
>

Are you using telnet in line rather than character mode?

-- 
John.


Relevant Pages

  • Re: Disable SSH authentication
    ... I interpreted that sentence of chaoson to mean "type in user ... some commands on the remote machine ... I remember to all of you that rsh or telnet are an input/output ... and interprets commands send to it through a ...
    (SSH)
  • Re: TN3270 *from* a host??
    ... It allows the end user to send commands to the TELNET server, ... "Reverting to linemode" implies that, somehow, the SNA session ...
    (bit.listserv.ibm-main)
  • Re: Using port 23 and issuing telnet commands...
    ... this is a method I once used to execute shell commands on a unix machine. ... public bool Exec(string Command, string Host, int Port,string UN, string ... > I've Googled until my eyes hurt looking for a way to issue Telnet ... > go to a telnet client and use it internally. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: flush telnet input
    ... >but I'm finding that my program running on $host:$port ... >I suspect that the telnet program is receiving a SIGPIPE ... >before it is able to actually send out the commands. ... Close, but SIGPIPE is sent to the writer, not the reader. ...
    (comp.unix.shell)
  • Re: Expect scripting
    ... is that if the command is entered with the arguements ... ,then the script would telnet to and login then transfer control back ... script file is capturing the shell cmd line and the commands are never ... sent to the telnet session. ...
    (comp.lang.tcl)