Is it possible to programmatically create two net.p2p clients for the SAME
mesh within the SAME process? It seems
peerNode, Uri via) checks to ensure the Resolver instances between bindings
are the same (among other things); if they are not then it throws an error.
The unfortunate side effect is that all of my net.p2p node instances within
a single process have the same NetPeerTcpBinding.Port number
// Create the instance context.
InstanceContext instanceContext = new InstanceContext(this);
// Create the contract.
ContractDescription contract =
// Create a peer binding with a custom resolver, which is required
// since the current operating system is the Windows 2003 Server family.
NetPeerTcpBinding binding = new NetPeerTcpBinding();
binding.Port = _node.PeerEndpointAddress.Uri.Port; // the port number is
different for each P2P client
binding.Security.Mode = SecurityMode.None;
binding.Name = _node.ToString();
// If the default PNPR service is not available then fall back to our custom
// peer resolver.
binding.Resolver.Custom.Address = new
binding.Resolver.Custom.Binding = new NetTcpBinding(SecurityMode.None,
// If I change this value of the Resolver property to be that of a static
member (same for all instances) then everything works.
// It seems
peerNode, Uri via)
// checks to ensure the Resolver instances between bindings are the same;
if they are not then it throws an error.
binding.Resolver.Custom.Resolver = new CustomerPeerResolver();
binding.Resolver.Mode = PeerResolverMode.Custom;
// Create the address.
ServiceEndpoint serviceEndpoint = new ServiceEndpoint(contract, binding,
serviceEndpoint.Name = _node.ToString();
// Create the participant with the given endpoint configuration
// Each participant opens a duplex channel to the mesh participant is an
instance of the
// chat application that has opened a channel to the mesh
_netPeerTcpChannelFactory = new
_netPeerTcpChannel = _netPeerTcpChannelFactory.CreateChannel(); // ERROR:
This line throws the attached error after the first iteration (for nodes 2
Any insight is appreciated.