1
Dear, I am trying to create a program that will receive a list of products sold through a Socket connection. I can connect via Tcpclient, but I’m not able to send the list of commands, nor receive the result that comes from the server. In my test, I can get one line, but I need to receive several lines. I’m doing like this:
procedure TForm1.Button4Click(Sender: TObject);
var
LLine : string;
begin
try
if not IdTCPClient1.Connected then
IdTCPClient1.Connect;
IdTCPClient1.SendCmd(Edit3.Text);
//LLine := IdTCPClient1.IOHandler.ReadLn();
Lline := IdTCPClient1.Socket.ReadString(6000);
mmLog.Lines.Add(LLine);
except
on E:Exception do
if ( E.Message <> 'Connection Closed Gracefully.') then
mmLog.Lines.Insert(0, 'ERROR: ' + E.Message);
end;
end;
I’m wearing Indy 10 and Delphi Tokyo.
I understood the idea... The problem is that it freezes when it calls the line: vTamanho := Idtcpclient1.IOHandler.Readln.Tointeger;
– Tonico Bittencourt
What is sending in
AContext.Connection.IOHandler.WriteLn('3');
?– Junior Moreira