为什么一个系留的firemonkey应用程序可能无法运行PC->Mac或PC->ios(但适用于PC->PC和Mac->ios)?



问题:我在Delphi XE10中创建的任何联机应用程序仅在两个应用程序在同一台机器(PC或Mac)上运行或与Mac/iOS配对时有效。PC/mac 和 PC/ios 无法正常工作。我已经尝试了RAD Studio XE10附带的MediaPlayer示例(在C:\Users\Public\Documents\Embarcadero\Studio\17.0\Samples\Object Pascal\Multi-Device Samples\Device Sensors and Services\App Tethering中),它无法以相同的方式连接(PC/Mac和PC/ios失败)。由于PC似乎是共同因素,我认为这可能是防火墙问题,但看起来没有什么不合适的,我什至在关闭防火墙的情况下尝试了这个,但它仍然不起作用)

对于一些实际代码,我将使用教程中的示例,该示例也以同样的方式失败:(可用的教程:http://www.malcolmgroves.com/blog/?p=1854)

  • 从两个多设备(firemonkey)应用程序(app1和app2)开始 - 在Delphi XE10的单独实例中创建每个应用程序
  • 在两者中,放入TetheringManager和TetheringAppProfile。
  • 在两者中,选择您的网络共享管理器作为网络共享AppProfile 中的经理
  • 在 App1 中放入按钮和标签
  • 在 App2 中放入标签
  • 在 App2 中将网络共享管理器的密码设置为 无翼鸽子保护它的巢

App1 代码:

procedure TForm1.Button1Click(Sender: TObject);  
begin  
  TetheringManager1.AutoConnect();  
end;
procedure TForm1.FormCreate(Sender: TObject);  
begin   
  Caption := format('App1 : %s', [tetheringmanager1.Identifier]);  
end;
procedure TForm1.TetheringManager1PairedToRemote(const Sender: TObject; const AManagerInfo: TTetheringManagerInfo);  
begin  
  label1.Text := Format('Connected : %s %s', [amanagerinfo.ManagerIdentifier, amanagerinfo.ManagerName]);  
end;
procedure TForm1.TetheringManager1RequestManagerPassword(const Sender: TObject; const ARemoteIdentifier: string; var Password: string);  
begin  
  Password := 'The wingless dove protects its nest';  
end;

应用2代码:

procedure TForm1.FormCreate(Sender: TObject);  
begin  
  caption := format('App2 : %s', [tetheringmanager1.Identifier]);  
end;
procedure TForm1.TetheringManager1PairedFromLocal(const Sender: TObject; const AManagerInfo: TTetheringManagerInfo);  
begin  
  label1.Text := Format('Connected : %s %s', [amanagerinfo.ManagerIdentifier, amanagerinfo.ManagerName]);  
end;

编译/构建/部署时,行为因目标而异,如上所述,如下所示。

+---------------------------+  
| App1  | App2  |  Outcome  |  
+-------+-------+-----------+  
|  PC1  |  PC1  |   success |
+-------+-------+-----------+  
|  PC1  |  Mac  | Failure   |
+-------+-------+-----------+  
|  PC1  |  ios  | Failure   |
+-------+-------+-----------+  
|  ios  |  PC1  | Failure   |
+-------+-------+-----------+  
|  ios  |  Mac  | Failure   |
+-------+-------+-----------+  
|  Mac  |  ios  |   Success |
+-------+-------+-----------+  
|  Mac  |  Mac  |   Success |
+-------+-------+-----------+  
|  Mac  |  PC1  | Failure   |
+-------+-------+-----------+  
|  PC1  |  PC2  | Failure   |
+-------+-------+-----------+  
|  PC2  |  PC2  |   Success |
+-------+-------+-----------+  

我遇到了同样的问题很长时间,直到今天,我所要做的就是在防火墙中创建入站和出站规则(控制面板\系统和安全\Windows防火墙\高级设置)并使用他的路径设置程序文件并打开所有端口并允许所有连接类型, 我明白了。

最新更新