commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [Telnet] how to determine the prompt?
Date Tue, 03 Jun 2008 15:37:43 GMT
On 03/06/2008, Uwe Fischer <mistuwefischer@web.de> wrote:
> Hello Sebb,
>
>  I'm afraid I still don't understand 100% what you say.
>  A human's terminal would be blocked as long as a command is being processed by the system,
wouldn't it?

No. Read what I wrote about type-ahead.

>  But using the API it's different, what would happen if you send a second command to
the remote machine while it is processing the first one?

Depends on the remote application.

>  I read about the ABORT OUTPUT control function, do you have clue whether this could
be used here? And if so, how it is being activated in the API?

No idea.

>  Thanks again and sorry for all the hassle :-)

I suggest you experiment with an exisiting Telnet client and connect
to the host you want to communicate with.

>  Regards,
>
> Uwe
>
>
>
>  > -----Ursprüngliche Nachricht-----
>  > Von: "sebb" <sebbaz@gmail.com>
>
> > Gesendet: 03.06.08 17:04:58
>
> > An: "Commons Users List" <user@commons.apache.org>
>  > Betreff: Re: [Telnet] how to determine the prompt?
>
>
>  > On 03/06/2008, Uwe Fischer <mistuwefischer@web.de> wrote:
>  > > Hello Sebb,
>  > >
>  > >  maybe we misunderstood one another...
>  > >  I was talking about the telnet client example, where the input stream is
read as long as a defined "prompt" character is found.
>  > >  E.g., http://www.informit.com/guides/content.aspx?g=java&seqNum=40
>  > >
>  > >  In this example a command like 'ls -l > output.txt' would not be handled
properly (of course only if ">" is defined to be the prompt too).
>  > >
>  >
>  > In which case, turn off echo.
>  >
>  > Or just look for > at or near the start of a line.
>  >
>  > As I wrote (twice) before, how does a human know when input is expected?
>  >
>  > >  I hope I do not confuse you. Actually I'm just looking for another way to
find out when a command has been executed. Isn't the telnet standard offering anything like
this? I mean, does the client get some kind of status about the remote machine (something
like "busy" or "waiting for command" or similar).
>  >
>  > No, AFAIK telnet does not address that.
>  >
>  > Besides, some OSes allow one to type-ahead, so even when the system is
>  > "busy" it will accept input (though this is usually fairly limited in
>  > size).
>  >
>  > >
>  > >  Cheers,
>  > >  Uwe
>  > >
>  > >
>  > >
>  > >
>  > >
>  > >  > On 03/06/2008, Uwe Fischer <mistuwefischer@web.de> wrote:
>  > >  > > Hi Sebb,
>  > >  > >
>  > >  > >  your idea to change the prompt sounds good. However, how would
I identify the very first appearance of the prompt in order to change it? Also, is this (changing
the prompt) possible for Windows based telnet servers aswell?
>  > >  > >
>  > >  >
>  > >  > It's not the telnet server that provides the prompt, it's the
>  > >  > application you are talking to, in that case presumably DOS.
>  > >  >
>  > >  > You either need to know what the prompt is in advance, or wait for a
timeout.
>  > >  >
>  > >  > As I wrote before: how does a human know the system is ready for input?
>  > >  >
>  > >  > >  Concerning your question, the problem with output redirection
is that the program would stop reading from the input stream, due to the appearance of ">"
which would indicate that the prompt has been reached. AFAIK.
>  > >  >
>  > >  > That does not make sense to me.
>  > >  >
>  > >  > If you telnet to a Unix system and issue the command:
>  > >  >
>  > >  > ls -l >list.txt
>  > >  >
>  > >  > the shell prompt will be issued as soon as the ls program has finished.
>  > >  >
>  > >  > >  Cheers,
>  > >  > >  Uwe
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >  > -----Ursprüngliche Nachricht-----
>  > >  > >  > Von: "sebb" <sebbaz@gmail.com>
>  > >  > >  > Gesendet: 03.06.08 14:40:16
>  > >  > >
>  > >  > > > An: "Commons Users List" <user@commons.apache.org>
>  > >  > >  > Betreff: Re: [Telnet] how to determine the prompt?
>  > >  > >
>  > >  > >
>  > >  > >  > On 03/06/2008, Uwe Fischer <mistuwefischer@web.de>
wrote:
>  > >  > >  > > Hello Pierre,
>  > >  > >  > >
>  > >  > >  > >  thanks for your answer.
>  > >  > >  > >  Yes, I did what you mention. But it's not "really"
solving my issue. The problem I face is that the devices I attach to can have the "#" or ">"
characters maintained in a user welcome messages when logging in. E.g., the following welcome
message is displayed when logging on to the device:
>  > >  > >  > >  ############################################
>  > >  > >  > >  Welcome at "hostname". In case of any issues contact
Uwe
>  > >  > >  > >  ############################################
>  > >  > >  > >
>  > >  > >  > >  How can one distinguish the "#" character when used
in a comment and when used to indicate the prompt?
>  > >  > >  > >
>  > >  > >  >
>  > >  > >  > Can you set the prompt to a string that is not likely to
be seen elsewhere?
>  > >  > >  > Maybe even include a control character such as ^G (bell).
>  > >  > >  >
>  > >  > >  > If not, you are probably going to have to use timeouts to
decide when
>  > >  > >  > output has finished.
>  > >  > >  >
>  > >  > >  > >  Another problem could occur when somebody would redirect
stdout of a Unix system to a file, e.g.:
>  > >  > >  > >  ls -l > output_list.txt
>  > >  > >  > >
>  > >  > >  > >  Any ideas?
>  > >  > >  >
>  > >  > >  > How would a human know when output has finished?
>  > >  > >  >
>  > >  > >  > >  Thanks and best regards,
>  > >  > >  > >  Uwe
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >  > -----Ursprüngliche Nachricht-----
>  > >  > >  > >  > Von: "Pierre Brico" <pierre.brico@tsdsoftware.eu>
>  > >  > >  > >  > Gesendet: 03.06.08 11:11:37
>  > >  > >  > >  > An: "Commons Users List" <user@commons.apache.org>
>  > >  > >  > >  > Betreff: Re: [Telnet] how to determine the prompt?
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >  > Hello Uwe,
>  > >  > >  > >  >
>  > >  > >  > >  > Did you try to change the command prompt before
executing the command. You
>  > >  > >  > >  > just should send commands to the shell like this:
>  > >  > >  > >  >
>  > >  > >  > >  > PS1="#>"
>  > >  > >  > >  > export PS1
>  > >  > >  > >  >
>  > >  > >  > >  > And you will get the "#>" as prompt.
>  > >  > >  > >  >
>  > >  > >  > >  > Pierre
>  > >  > >  > >  >
>  > >  > >  > >  > On Tue, Jun 3, 2008 at 10:50 AM, Uwe Fischer <mistuwefischer@web.de>
wrote:
>  > >  > >  > >  >
>  > >  > >  > >  > > Hello all,
>  > >  > >  > >  > >
>  > >  > >  > >  > > I'm looking for a solution to a problem that
bothers me for quite some time
>  > >  > >  > >  > > now and I hope somebody here can help me
out.
>  > >  > >  > >  > > I'm using the telnet api to connect to various
systems, which works fine.
>  > >  > >  > >  > > The problem I face is, how can I determine
that a command has run to its
>  > >  > >  > >  > > end if there is no static "prompt" character
like "#" or ">", but
>  > >  > >  > >  > > dynamically changing prompt characters?
>  > >  > >  > >  > >
>  > >  > >  > >  > > I have read through the Telnet specification
but couldn't find anything
>  > >  > >  > >  > > that deals with this kind of problem. But
surely there must be a solution to
>  > >  > >  > >  > > this. I have found another thread in this
mailing list concerning a similar
>  > >  > >  > >  > > issue, posted by: Anthony Webster Thu, 28
Feb 2008 10:54:35 GMT.
>  > >  > >  > >  > > Unfortunately none has answered it yet.
>  > >  > >  > >  > >
>  > >  > >  > >  > > Thanking in advance,
>  > >  > >  > >  > > U.F.
>  > >  > >  > >  > >
>  > >  > >  > >  > >
>  > >  > >  > >  > > ______________________________________________________________
>  > >  > >  > >  > > Jeden Monat 1 hochkarätiger maxdome-Blockbuster
GRATIS!
>  > >  > >  > >  > > Exklusiv für alle WEB.DE Nutzer. http://www.blockbuster.web.de
>  > >  > >  > >  > >
>  > >  > >  > >  > >
>  > >  > >  > >  > > ---------------------------------------------------------------------
>  > >  > >  > >  > > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > >  > >  > >  > > For additional commands, e-mail: user-help@commons.apache.org
>  > >  > >  > >  > >
>  > >  > >  > >  > >
>  > >  > >  > >  >
>  > >  > >  > >  >
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > > _______________________________________________________________________
>  > >  > >  > >  Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE.
30 Tage
>  > >  > >  > >  kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  > >  ---------------------------------------------------------------------
>  > >  > >  > >  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > >  > >  > >  For additional commands, e-mail: user-help@commons.apache.org
>  > >  > >  > >
>  > >  > >  > >
>  > >  > >  >
>  > >  > >  > ---------------------------------------------------------------------
>  > >  > >  > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > >  > >  > For additional commands, e-mail: user-help@commons.apache.org
>  > >  > >  >
>  > >  > >  >
>  > >  > >
>  > >  > >
>  > >  > >  _______________________________________________________________________
>  > >  > >
>  > >  > > EINE FÜR ALLE: die kostenlose WEB.DE-Plattform für Freunde und
Deine
>  > >  > >  Homepage mit eigenem Namen. Jetzt starten! http://unddu.de/?kid=kid@mf2
>  > >  > >
>  > >  > >
>  > >  > >
>  > >  > >  ---------------------------------------------------------------------
>  > >  > >  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > >  > >  For additional commands, e-mail: user-help@commons.apache.org
>  > >  > >
>  > >  > >
>  > >  >
>  > >  > ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > >  > For additional commands, e-mail: user-help@commons.apache.org
>  > >  >
>  > >  >
>  > >
>  > >
>  > >  _______________________________________________________________
>  > >
>  > > Schon gehört? Der neue WEB.DE MultiMessenger kann`s mit allen:
>  > >  http://www.produkte.web.de/messenger/?did=3016
>  > >
>  > >
>  > >
>  > >  ---------------------------------------------------------------------
>  > >  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > >  For additional commands, e-mail: user-help@commons.apache.org
>  > >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: user-help@commons.apache.org
>  >
>  >
>
>
>
> _________________________________________________________________________
>  In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!
>  Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>  For additional commands, e-mail: user-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message