Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Indigo

Creation of Multple net.p2p Client

 
 
Thread Tools Display Modes
Old 07-02-2006   #1 (permalink)
Michael Primeaux
Guest


 

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




 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multple desktops fastjetflyer General Discussion 5 6 Days Ago 04:07 AM
PDF Creation? niagara94 Vista General 5 05-28-2008 10:54 AM
XML Document creation ebgreen PowerShell 3 11-05-2007 06:19 PM
multple email accounts John Malia Vista mail 2 08-22-2007 08:03 PM
Problems running multple sound devices blackgold9 Vista music pictures video 0 07-03-2006 10:05 AM








Vistax64.com 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 2005-2008

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 47 48 49 50