Heyy all,
I am trying to make my program auto-connect on form create & re-connect on disconnect... Trouble is, the lNet TCP component doesn't seem to know when it is connected or not... I have tried this on Formcreate:
Repeat
SafeSleep(1000);
Memo1.Lines.Add('Attempting to Reconnect...');
TCP.Connect('127.0.0.1',43590);
Application.ProcessMessages;
SafeSleep(2000);
until TCP.Connected;
I have also tried this on FormCreate:
While (not TCP.Connected) do begin
SafeSleep(1000);
Memo1.Lines.Add('Attempting to Reconnect...');
TCP.Connect('127.0.0.1',43590);
Application.ProcessMessages;
SafeSleep(2000);
end;
I have also tried using my own boolean and setting it to true upon TCPConnect, this also does not work.
In the TCPDisconnect procedure I have used near enough the same code, any ideas on how to get this working, also, I am running the first autoconnect procedure in the FormCreate section, unfortuantly this is causing the form not to show until the loop has finished, does anyone know how to get the form to load before starting the loop??
I am severely confused about this thus any help will be greatly appreciated.
Thanks
Logic~