Presentation is loading. Please wait.

Presentation is loading. Please wait.

Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel Sandeep K. Singhal COM311 Product Unit.

Similar presentations


Presentation on theme: "Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel Sandeep K. Singhal COM311 Product Unit."— Presentation transcript:

1 Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel Sandeep K. Singhal COM311 Product Unit Manager Microsoft Corporation COM 311

2 2 Agenda Peer-to-Peer defined Why P2P? How Microsoft is enabling P2P P2P application lifecycle IdentifyOrganizeCommunicate Call to action

3 3 What Is Peer-To-Peer (P2P)? One-to-one, one-to-many, many-to-many Directly communicating PCs Telephony and video Chat Co-editing Gaming Data access and replication

4 4 Why Use P2P? Eliminate bottlenecks, improve scalability Lower deployment costs and complexity Faster data transmission Support ad-hoc and disconnected networks Better resilience – no single point of failure Powerful social interactions Reduce Reliance on Servers Direct Client Connections P2P Systems

5 5 Addressing P2P Challenges Universal connectivity Hard to build P2P applications Unsafe to deploy IPv6 and Teredo connect most consumer NATs Well-engineered protocols, built-in security Comprehensive developer platform supporting P2P Application Operations

6 6 P2P Application Operations Find peer Send invitation Create session One-to-One

7 7 P2P Application Operations Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many

8 8 P2P Application Operations Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many

9 9 1. Find Peers Locate other endpoints for P2P communication? Discover others on your LAN People Near Me: Uses WS-Discovery to find all signed-in people COM319: Integrating People Near Me Into Your Applications Find peers or peer groups by name Peer Name Resolution Protocol (PNRP): Secure, server-less name resolution over the Internet or local LANs Find peer Send invitation Create session Learn mesh name Join mesh One-to-OneOne-to-ManyMany-to-Many

10 10 Peer Name Resolution Protocol No service signup Scalable from ad-hoc to Internet Built-in security Name records signed by public-private keys Name machines, users, or arbitrary resources Multiple names per machine Multiple endpoints per name Name records can contain a limited amount of arbitrary data

11 11 PNRP Resolve a name Integrated into standard name resolution getaddrinfo(), System.net Works with many existing applications PNRP names use *.pnrp.net domain hr = PeerPnrpResolve(“0.SandeepPictures”, NULL, &cEndpoints, &pEndpoints); PWSTR pwzHostName = NULL; HRESULT hr = PeerNameToPeerHostName(L”0.SandeepPictures”, &pwzHostName); if (SUCCEEDED(hr)) { ADDRINFO *pai, ai = {0}; ADDRINFO *pai, ai = {0}; ai.ai_family = AF_INET6; ai.ai_family = AF_INET6; getaddrinfo(pwzHostName, NULL, &ai, &pai); getaddrinfo(pwzHostName, NULL, &ai, &pai); PeerFreeData(pwzHostName); PeerFreeData(pwzHostName);}

12 12 PNRP Publish a name // The null 2nd param means the API should pick address for you, // The null 2nd param means the API should pick address for you, // register in all clouds, re-register if your addresses change // register in all clouds, re-register if your addresses change HANDLE hReg; HRESULT hr = PeerPnrpRegister(L”0.SandeepPictures”, NULL, &hReg);

13 13 PNRP Enables P2P Photo Sharing

14 14 2. Send Invitation Real-time invitation to People Near Me or Contacts over Internet User message Application data (IP, port, mesh name) System listener pops invitation prompt, then launches app More details at COM319 (Integrating People Near Me Into Your Applications) on Thursday Find peer Send invitation Create session Learn mesh name Join mesh One-to-OneOne-to-ManyMany-to-Many

15 15 3. Join Mesh Specify mesh name and credentials Use mesh for multi-party communication Find peer Send invitation Create session Learn mesh name Join mesh One-to-OneOne-to-ManyMany-to-Many

16 16 How P2P Meshes Work Identified by name Used to locate some existing members and connect to them Active members publish mesh name so others can find them Mesh self-organizes active participants Adjusts to changing membership Resilient connectivity Dynamically optimized based on traffic patterns

17 17 Two Flavors Of Mesh Data replication service: Grouping Available in Windows Vista and XPSP2 Exchange messages by replicating data records Message service: Peer Channel Part of Windows Communication Foundation Share data by building synchronization and transaction services

18 18 Comparing Mesh Options Peer Channel Grouping Replicated database among active nodes Directed connections through TCP Message flooding with per-hop message filters Directed connections through TCP channels PNRP PNRP Developer-supplied (e.g., web service) Service Model NodeDiscovery Password Group certificates (managed by mesh) Password Individual certificates (managed by app.) Security APIs Native Managed Key Apps Group collaboration Content distribution

19 19 Stock Quote Distribution Using The Peer Channel

20 20 Contracts And Messages Channel: Message I/O Mechanism Message: Data sent to Service Service: Targets for Message Delivery Contract: Which Messages are Understood Message Channel Channel Service Transport Contract

21 21 Contracts [ServiceInterface] public interface IQuoteChange { [ServiceMethod] void PriceChange (Quote quote); } Message Channel [Service] public class QuoteHandler : IQuoteChange { public void PriceChange(Quote quote) { // update quote display component; } Message Channel

22 22 Stock Quote Distribution The message interface [ServiceContract(Namespace="http://Microsoft.ServiceModel.Samples.PeerChannel")][PeerBehavior] public interface IQuoteChange { [OperationContract(IsOneWay = true)] [OperationContract(IsOneWay = true)] void PriceChange(string item, double change, double price); void PriceChange(string item, double change, double price);} public interface IQuoteChannel : IQuoteChange, IClientChannel { }

23 23 Stock Quote Distribution Sender service contract <system.serviceModel> <client> <endpoint configurationName=“QuoteSenderEndpoint" <endpoint configurationName=“QuoteSenderEndpoint" address="net.p2p://FreeQuotes/Stocks“ address="net.p2p://FreeQuotes/Stocks“ binding="netPeerTcpBinding" binding="netPeerTcpBinding" bindingConfiguration=“QuoteSenderBinding" bindingConfiguration=“QuoteSenderBinding" contract="Microsoft.ServiceModel.Samples.IQuoteChange"> contract="Microsoft.ServiceModel.Samples.IQuoteChange"> </client> <bindings> <netPeerTcpBinding> <binding configurationName=“QuoteSenderBinding" <binding configurationName=“QuoteSenderBinding" port="7001" port="7001" messageAuthentication="true" /> messageAuthentication="true" /> </netPeerTcpBinding> </bindings></system.serviceModel>

24 24 Stock Quote Distribution Sender.Cs // Create a channel factory with the configuration // Create a channel factory with the configuration ChannelFactory cf = new ChannelFactory (“QuoteSenderEndpoint"); ChannelFactory (“QuoteSenderEndpoint"); // Specify mesh password, certificate for secure connections // Specify mesh password, certificate for secure connections PeerSecurityBehavior security = new PeerSecurityBehavior(); security.Password = args[0]; X509Certificate2 selfCredentials = GetCertificate(StoreName.My, StoreLocation.CurrentUser, recognizedSender, StoreLocation.CurrentUser, recognizedSender, X509FindType.FindBySubjectDistinguishedName); X509FindType.FindBySubjectDistinguishedName);security.SetSelfCertificate(selfCredentials); // To enable message authentication, specify validator to point to my cert // To enable message authentication, specify validator to point to my cert security.SetMessageX509Authentication(new SenderValidator(selfCredentials)); // Finally, attach the behavior before opening the channel factory. // Finally, attach the behavior before opening the channel factory.cf.Description.Behaviors.Add(security); // Create proxy from channel factory and open it // Create proxy from channel factory and open it IQuoteChannel sender = (IQuoteChannel)cf.CreateChannel(); sender.Open(); // Start sending stock quotes using this proxy // Start sending stock quotes using this proxy sender.PriceChange(“ABCY”,-0.50, 99.50);

25 25 Stock Quote Distribution Receiver service contract <system.serviceModel> <services> <endpoint address="Stocks" <endpoint address="Stocks" binding="netPeerTcpBinding" bindingConfiguration=“QuoteReceiverBinding" contract="Microsoft.ServiceModel.Samples.IQuoteChange" /> contract="Microsoft.ServiceModel.Samples.IQuoteChange" /> </service> </services> <bindings> <netPeerTcpBinding> <binding configurationName=“QuoteReceiverBinding" <binding configurationName=“QuoteReceiverBinding" port="6001" port="6001" messageAuthentication="true" /> messageAuthentication="true" /> </netPeerTcpBinding> </bindings></system.serviceModel>

26 26 Stock Quote Distribution Receiver.Cs Uri baseAddress = new Uri(ConfigurationManager.AppSettings["baseAddress"]); ServiceHost receiver = new ServiceHost(new QuoteReceiver(), new Uri[] { baseAddress }); new Uri[] { baseAddress }); // Specify mesh password, certificate for secure connections // Specify mesh password, certificate for secure connections PeerSecurityBehavior security = new PeerSecurityBehavior(); security.Password = args[0]; X509Certificate2 selfCredentials = GetCertificate(StoreName.My, StoreLocation.CurrentUser, “CN=“+member, StoreLocation.CurrentUser, “CN=“+member, X509FindType.FindBySubjectDistinguishedName); X509FindType.FindBySubjectDistinguishedName);security.SetSelfCertificate(selfCredentials); // Specify that only messages signed with identified cert should be accepted // Specify that only messages signed with identified cert should be accepted publisherCredentials = GetCertificate(StoreName.TrustedPeople, StoreLocation.CurrentUser, StoreLocation.CurrentUser, recognizedPublisherName, recognizedPublisherName, X509FindType.FindBySubjectDistinguishedName); X509FindType.FindBySubjectDistinguishedName);security.SetMessageX509Authentication( new PublisherValidator(publisherCredentials)); new PublisherValidator(publisherCredentials)); // Add the behavior to the servicehost and open it. // Add the behavior to the servicehost and open it.receiver.Description.Behaviors.Add(security);receiver.Open();

27 27 Future Directions Beyond windows vista and WCF Enhanced mesh services Replicated data, distributed agreement, voting Enhanced mesh algorithms Real-time / QoS Flexible messaging Subgroups, routing control

28 28 Call To Action Look to P2P and collaboration To enhance performance To enhance resiliency Join the Windows Vista and Windows Communication Foundation beta program The peer-to-peer platform is available in both the Beta 1 and PDC builds!

29 29 Community Resources At PDC: For more information, see Hands-on Lab: People Near Me Hands-on Lab: Peer Channel Talk COM319 (Integrating People Near Me Into Your Applications) on Thurs. 10am) Ask The Experts tables (Thursday) – P2P Native and Managed After PDC Feedback/Questions: peerfb@microsoft.com peerfb@microsoft.com Newsgroupsmicrosoft.public.win32.programmer.networksmicrosoft.public.platformsdk.networkingmicrosoft.public.platformsdk.networking.ipv6Blogs http://blogs.msdn.com/noahh http://blogs.msdn.com/tparks Websites http://www.microsoft.com/p2p http://www.microsoft.com/ipv6

30 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel Sandeep K. Singhal COM311 Product Unit."

Similar presentations


Ads by Google