简体   繁体   English

Delphi与多个网络适配器共享

[英]Delphi tethering with multiple network adapters

i have been using for a while application tethering with Delphi and i have discovered what its seems to be a bug. 我一直在使用一段时间与Delphi绑定应用程序,我发现它似乎是一个错误。 Trying to connect two applications in the same network on two pcs with multiple intefaces (VirtualBox or VMware adapters) doesn't work. 尝试在具有多个接口(VirtualBox或VMware适配器)的两台PC上连接同一网络中的两个应用程序不起作用。 I tried using the target parameter in AutoConnect or DiscoverManagers, but they could not pair or connect. 我尝试在AutoConnect或DiscoverManagers中使用target参数,但它们无法配对或连接。 It seems that the adapter in TTetheringManager binds to the incorrect network adapter and it is impossible for the client to discover this manager. 似乎TTetheringManager中的适配器绑定到不正确的网络适配器,客户端无法发现此管理器。 Any ideas?. 有任何想法吗?。 I'm using Delphi Seattle. 我正在使用Delphi Seattle。

I know that is not the best solution, but worked to me. 我知道这不是最好的解决方案,但对我有用。

I created a new property in TTetheringManager class: 我在TTetheringManager类中创建了一个新属性:

...

private

FServerAddress: string;

...

public

property ServerAddress: string read FServerAddress write FServerAddress;

...

Then, I changed the following method: 然后,我改变了以下方法:

function TTetheringManagerCommunicationThread.CreateManagerInfo(const AIdentifier, AName, AText,

  AConnectionString: string; AVersion: Integer): TTetheringManagerInfo;

begin
  Result.ManagerIdentifier := AIdentifier;
  Result.ManagerName := AName;
  Result.ManagerText := AText;
  Result.ConnectionString := AConnectionString;
  Result.Version := AVersion;

  if (Trim(FAdapter.Manager.FServerAddress) <> '') then
    begin
      FAdapter.FAdapterConnectionString := Copy(FAdapter.FAdapterConnectionString, Pos('$', FAdapter.FAdapterConnectionString), Length(FAdapter.FAdapterConnectionString));
      FAdapter.FAdapterConnectionString := FAdapter.Manager.ServerAddress + FAdapter.FAdapterConnectionString;
    end;

  Result.Adapter := FAdapter;
end;

So, I set the property ServerAddress before to enable the TetheringManager. 因此,我先设置属性ServerAddress以启用TetheringManager。

I hope to helped. 我希望能帮到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM