Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - Creation of Multple net.p2p Client

 
 
Old 07-02-2006   #1 (permalink)
Michael Primeaux


 
 

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 SpecsSystem Spec
 

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46