Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Oct : Using TIdTCPClient and TIdTCPServer
| Subject: | Using TIdTCPClient and TIdTCPServer |
| Posted by: | "Mikael Lenfors" (mika..@lenfors.se) |
| Date: | Mon, 2 Oct 2006 15:27:43 |
I have a very basic communication need between two applications. Application
A should be able to connect to application B and send a text string.
Application B should reply with a response string. I thougth the Indy
TCPClient and Indy TCPServer would do fine.
I tried the following:
Application A:
IdTCPClient.Connect;
IdTCPClient.SendCmd('Test', []); // Send my string <- Application
hangs here!
IdTCPClient.GetResponse(250);
Tx := IdTCPClient.LastCmdResult.Code; // get the answer
IdTCPClient.DisConnect;
Applicaton B:
Procedure TForm5.IdTCPServerExecute(AContext: TIdContext);
Var Txt: String;
Begin
Txt := Trim(AContext.Connection.IOHandler.ReadLn);
AContext.Connection.IOHandler.Write(Txt + 'responsedata');
End;
This does not work! The SendCmd (application A) command seems to hang. The
server (application B) receives the string 'Test' so this far it's good.
I'm missing the SendString method!?
Please help,
Regards, Mikael