![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Creation of Multple net.p2p Client Is it possible to programmatically create two net.p2p clients for the SAME mesh within the SAME process? It seems System.ServiceModel.Channels.PeerNodeImplementation.Registration.CheckIfCompatible(PeerNodeImplementation 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 <snippet> // // Create the instance context. // InstanceContext instanceContext = new InstanceContext(this); // // Create the contract. // ContractDescription contract = ContractDescription.GetContract(typeof(IXRingDhtMulticastMembership)); // // 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. // if (!NetPeerTcpBinding.IsPnrpAvailable) { binding.Resolver.Custom.Address = new EndpointAddress("net.tcp://localhost/p2p/PeerResolverService"); binding.Resolver.Custom.Binding = new NetTcpBinding(SecurityMode.None, true); // // 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 System.ServiceModel.Channels.PeerNodeImplementation.Registration.CheckIfCompatible(PeerNodeImplementation 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, _node.PeerEndpointAddress); 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 DuplexChannelFactory<IXRingDhtMulticastMembershipChannel(instanceContext , serviceEndpoint); _netPeerTcpChannel = _netPeerTcpChannelFactory.CreateChannel(); // ERROR: This line throws the attached error after the first iteration (for nodes 2 and greater). </snippet> Any insight is appreciated. Thanks, Michael |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Quick Views with multple accounts | Live Mail | |||
| Multple desktops | General Discussion | |||
| PDF Creation? | Vista General | |||
| multple email accounts | Vista mail | |||
| Problems running multple sound devices | Vista music pictures video | |||