Send/Receive text using sockets in fmx

  

I have a problem to Send and Receive text I put the ip local and also ip public but can’t receive string from app to mobile this is my code
client

procedure tForm1.hellow(const AHost : string; const APort : integer);
begin
with IdTCPClient1 do
begin
Port := APort;
Host := AHost;
try
Connect; //connecte
Try

IdTCPClient1.Socket.WriteLn(‘hellow firemonkey ‘);
if IdTCPClient1.Socket.ReadLn()<>’OK’ then
ShowMessage (‘Erreur : l”exécution a été refusée par le serveur.’);
finally
Disconnect;
end;
except
ShowMessage(‘Une erreur est survenue durant l”envoi de commandes’);
end;
end;
end;

server

procedure TForm2.FormCreate(Sender: TObject);
begin
IdTCPServer1.DefaultPort:=3000;
IdTCPServer1.OnExecute:=IdTCPServer1Execute;
IdTCPServer1.Active:=true;
end;

procedure TForm2.IdTCPServer1Execute(AContext: TIdContext);

var
Line, Command, Args : String;
begin

Line := AContext.Connection.Socket.ReadLn;
Memo1.Lines.Add(line);
end;

Comments are closed.