What is the correct way to use this routine? How do i stop it from
freezing the app.
Thank you
Dean
> Hi I am trying to send a telnet command using the sendCmd() routine.
You cannot use SendCmd() with TIdTelnet at all. TIdTelnet has an internal
reading thread that interfers with SendCmd()'s own reading, and vice versa.
The only reason SendCmd() exists in TIdTelnet is because it is inherited
from TIdTCPConnection. TIdTelnet is not designed to be used as a
command+response component. To send a command, you can use WriteLn()
instead of SendCmd(), but to receive the response you have to use the
OnDataAvailable event and buffer the inbound data separately.
> The command is defiantly being sent because the command is received
> by the host. The problem is that the component then freezes the app.
As it should be. TIdTelnet's internal reading thread ends up receiving some
or all of the data that SendCmd() is expecting, thus SendCmd() becomes
blocked waiting for data it will never receive.
> What is the correct way to use this routine?
Don't use SendCmd() with TIdTelnet at all. Use TIdTCPClient directly
instead.
Gambit