idtcpclient problem

I've got some code like the following on client side. The TCPServer is
handling everything with command handlers.
In the following code, the first response to command 'RINI' is working
all fine. However, on the following sendcmd(RDBNAMES) line, the client
is freezing. In the meantime, the idtcpclient.connect method is in
initialization and i want the client application to be connected to
the server all times until application.terminate.

What am i doing wrong in this freezing line?

   on E : Exception do ShowMessage(E.Message);
   rInit_Sysaudit       := remoteinifile.ReadBool('INIT', 'SYSAUDIT',
   rLogin_Optionsfolder := remoteinifile.ReadString('LOGIN',
   rDirectories_DefaultDir := remoteinifile.ReadString('DIRECTORIES',
-->Freezing in the following line!


Thanks in advance,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hello febalci.
  In response to your topic i'm wirting the next:
  I happend to crush onto the same problem once, and I fixed it in a realy simple way:
  Onto the CommandHandler's OnCommand event, First of all I wrote the next line, Asender.SendReply; , I don't quite know way, but it seems even if the server object sends the response automatically the client objects doesn't detect it like that, and keeps waiting for the response, so if you wanna send another command, it will wait until response timeout, before sending it, also freezing that part of the thread.

  So Go to you server's object CommandHandlers property, and select the onw which triggers with 'RINI', then go to the event OnCommand, and on it Write Asender.SendReply; and it shouldn't freeze on the next command you send.
  And here comes the ugly part: You must repeat the process for every command, if one doesn't have it (including the quit one), the client will not be able to process anything more (not even the disconnection).

  Other way to fix it is to set a Timeout, but, I wouldn't do it since Response time depends on the connection, and some may be very unstable.

Ohh, and by the way it freezes while procesing the TCPForm.IdTCPClient1.SendCmd('RDBNAMES'); line, instead of the following one, the trace doesn't show it, but the previous line stays trapped in a loop.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
febalciAuthor Commented:
Thanks a lot,works fine now...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.