WCF P2P サービスを開始する次のコードがあります。
private static readonly EndpointAddress EndpointAddress =
new EndpointAddress("net.p2p://eigenein.Test.Wcf");
...
public void Start()
{
NetPeerTcpBinding binding = new NetPeerTcpBinding();
binding.Security.Mode = SecurityMode.None;
ServiceEndpoint endpoint = new ServiceEndpoint(
ContractDescription.GetContract(typeof(IChat)),
binding,
EndpointAddress);
endpoint.Behaviors.Add(new ProtoEndpointBehavior());
host = new Chat();
channelFactory = new DuplexChannelFactory<IChatChannel>(
new InstanceContext(host), endpoint);
channel = channelFactory.CreateChannel();
channel.Open();
}
私が理解しているように、WCF はリスニング ポートと他のピアに接続するポートを自動的に決定します。しかし、ピアごとに 2 つの特定の異なるポート (リッスンするポートと他のピアに接続する特定のポート) を設定できますか? 何かのようなもの:
private static readonly EndpointAddress SourceEndpointAddress =
new EndpointAddress("net.p2p://eigenein.Test.Wcf:808");
private static readonly EndpointAddress TargetEndpointAddress =
new EndpointAddress("net.p2p://eigenein.Test.Wcf:909");
私が達成したいこと: ピアが静的な NAT ポート マッピングを介して接続できるようにします。これらのマッピングを変更できません。