if CBClientActive.Checked = true then
begin
for i := 0 to strtoint(Edit_ClientNum.text) - 1 do
begin
tcpClient[i] := TIdTCPClient.Create(self);
// tcpClient[i].Host := '192.168.0.54';
//tcpClient[i].Port := 5000;
end;
try
for i := 0 to strtoint(Edit_ClientNum.text) - 1 do
begin
if (Edit2.Text<>'') and (Edit3.Text<>'') then
begin
try
tcpClient[i].Host:=Edit2.Text;
tcpClient[i].Port:=strtoint(Edit3.text);
tcpClient[i].Connect(); // in Indy < 8.1 leave the parameter away
GetValue(i);
AppendTreeList(RecordList);
ProgramDelay(10);
except
end;
end;
end;
ClientHandleThread := TClientHandleThread.Create(True);
ClientHandleThread.FreeOnTerminate:=True;
ClientHandleThread.Resume;
except
on E: Exception do MessageDlg ('Error while connecting:'+#13+E.Message, mtError, [mbOk], 0);
end;
end
else
begin
ClientHandleThread.Terminate;
//Client.Disconnect;
end;