Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : INDY TIdTCPClient and TIdTCPServer Usage
| Subject: | INDY TIdTCPClient and TIdTCPServer Usage |
| Posted by: | "Dennis" (mariannd..@home3.gvdnet.dk) |
| Date: | Mon, 20 Mar 2006 14:39:41 |
Hi
I am having some beginners problems using the TIdTCPClient and TIdTCPServer
components
I have made to basic Win32 applications - one for the client part and one as
server.
I am able to connect and send one string with the SendCMD method. The
problem is that the method fails returning because it does not accept the
answer from the server.
I am using this code in the client
IdTCPClient1.SendCmd('Hello', 'OK');
and this in the server
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
lCmd: string;
begin
lCmd := Trim(AContext.Connection.IOHandler.ReadLn);
//RichEdit1.Lines.Add('OnExecute triggered');
RichEdit1.Lines.Add(lCmd);
//AContext.Connection.IOHandler.WriteLn('Data Received');
AContext.Connection.IOHandler.WriteLn('OK');
//AContext.Connection.IOHandler.WriteLn('');
end;
The client raises an exception "Reply code is not valid: OK".
I also tried this code
IdTCPClient1.SendCmd('Hello', -1);
but it fails too.
What can be wrong?
Best regards
Dennis Kjaer Christensen