My project uses the tethering components from Delphi 10.4.
In some cases the components fail to connect, often where they connected in the past on the same network. The components give no errors. The Windows firewall shows that the project app is included in its list of app exceptions.
How can my project test that the tethering component can read and write data from the internet?
Here is the code on the consuming side:
procedure TChessOpeningsWizardMainForm.ChessEngineTetheringManagerEndManagersDiscovery(
const Sender: TObject; const ARemoteManagers: TTetheringManagerInfoList);
var
i: Integer;
theTotalPaired: Integer;
begin
// ShowMessage('There were ' + IntToStr(ARemoteManagers.Count) + ' chess engine remote managers found.');
theTotalPaired := 0;
for i:=0 to ARemoteManagers.Count-1 do
if ARemoteManagers[i].ManagerText = 'COWEngineManager'
then
begin
{$IFDEF DEBUG}
CodeSite.Send('COW ChessEngineTetheringManagerEndManagersDiscovery: Calling PairManager[' + IntToStr(i) + ']');
{$ENDIF}
ChessEngineTetheringManager.PairManager(ARemoteManagers[I]); // FIXEDIN build 38
Inc(theTotalPaired);
end;
fEngineTetheringIsConnected := (theTotalPaired > 0); // FIXEDIN build 40
ArrangeVisualComponents;
// ShowMessage('Out of ' + IntToStr(ARemoteManagers.Count) + ' remote managers found, ' + IntToStr(theTotalPaired) + ' were paired.');
// CodeSite.Send('Out of ' + IntToStr(ARemoteManagers.Count) + ' remote managers found, ' + IntToStr(theTotalPaired) + ' were paired.');
{$IFDEF DEBUG}
CodeSite.Send('COW Out of ' + IntToStr(ARemoteManagers.Count) + ' remote COWEngineManager(s) found, ' + IntToStr(theTotalPaired) + ' were paired.');
{$ENDIF}
if (theTotalPaired = 0) and
(fProgramMode = kModeNormal)
then SetMode(kModeShowChessEngineServerNotFound);
end;
procedure TChessOpeningsWizardMainForm.ChessEngineTetheringManagerEndProfilesDiscovery(
const Sender: TObject; const ARemoteProfiles: TTetheringProfileInfoList);
var
i: Integer;
begin
for i:=0 to ChessEngineTetheringManager.RemoteProfiles.Count-1 do
ChessEngineTetheringAppProfile.Connect(ChessEngineTetheringManager.RemoteProfiles[i]);
if (ChessEngineTetheringManager.RemoteProfiles.Count > 0)
then
begin
{$IFDEF DEBUG}
CodeSite.Send('ChessEngineTetheringManagerEndProfilesDiscovery called with ' + ChessEngineTetheringManager.RemoteProfiles.Count.ToString + ' remote profiles.');
{$ENDIF}
fEngineTetheringIsConnected := True;
ArrangeVisualComponents;
UpdateEngineWithCurrentPosition;
end
else
begin
{$IFDEF DEBUG}
CodeSite.Send('ChessEngineTetheringManagerEndProfilesDiscovery called but with no remote profiles.');
{$ENDIF}
end;
end;