Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Detect when command complete
| Subject: | Detect when command complete |
| Posted by: | "Jon" (jonjaco..@comcast.net) |
| Date: | 3 May 2006 07:44:54 |
D7, Indy 9.00.10
I have a server app using TIdTCPServer and a client app using TIdTCPClient.
The client app sends a series of text lines to the server, then sends a command
to save them. The server saves the whole series of lines as a text file.
The problem is that I get a 0 response code back for each line,
indicating successful receipt, but when I send the save command,
the server app has not processed (receiving) all the lines, even
though it sent back a success response for each one.
If I put a sleep command in the client before sending the save, it
all works fine. The more lines I send, the longer the sleep has to
be. At that point it is guesswork.
Is there a way detect if the server has finished processing all the
commands for that connection (each connection is a separate thread)
so I don't have to put in an arbitrary sleep?
Server uses HandleCommands
Right now, both apps are on the same machine, but when all the kinks
are ironed out, the server app will become an NT service on a remove
server machine.
There is probably a better way to send a file to a service than 1 text
line at a time, and I would love to know it. It would be extra great if
it could send binary files (then I could zip the file before sending).
Even so, I would still like to know the solution to the above.
Thanks,
Jon