1 / 30

Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel

COM 311. Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel. Sandeep K. Singhal COM311 Product Unit Manager Microsoft Corporation. Agenda. Peer-to-Peer defined Why P2P? How Microsoft is enabling P2P P2P application lifecycle

uta
Download Presentation

Developing P2P Applications Using Windows Vista And The Windows Communication Foundation (“Indigo”) PeerChannel

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Agenda • Peer-to-Peer defined • Why P2P? • How Microsoft is enabling P2P • P2P application lifecycle • Identify • Organize • Communicate • Call to action

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

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

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

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

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

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

  9. One-to-Many Many-to-Many One-to-One Find peer Send invitation Learn mesh name Join mesh Create session 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

  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. PNRPResolve 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};             ai.ai_family = AF_INET6;             getaddrinfo(pwzHostName, NULL, &ai, &pai);             PeerFreeData(pwzHostName); }

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

  13. PNRP Enables P2PPhoto Sharing

  14. One-to-Many Many-to-Many One-to-One Find peer Send invitation Learn mesh name Join mesh Create session 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

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

  16. How P2P Meshes Work • Identified by name • Used to locate some existingmembers and connect to them • Active members publish mesh nameso others can find them • Mesh self-organizes activeparticipants • Adjusts to changing membership • Resilient connectivity • Dynamically optimized based ontraffic patterns

  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. Comparing Mesh Options Grouping Peer Channel Replicated database among active nodes Directed connections through TCP Service Model Message flooding withper-hop message filters Directed connections through TCP channels Security Password Group certificates (managed by mesh) Password Individual certificates (managed by app.) PNRP PNRP Developer-supplied (e.g., web service) Node Discovery APIs Native Managed Key Apps Group collaboration Content distribution

  19. Stock Quote DistributionUsing The Peer Channel

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

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

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

  23. Stock Quote DistributionSender service contract <system.serviceModel>    <client>       <!– A (broadcast) Peer Channel, using TCP (see below -->       <endpoint configurationName=“QuoteSenderEndpoint"                 address="net.p2p://FreeQuotes/Stocks“                 binding="netPeerTcpBinding"                 bindingConfiguration=“QuoteSenderBinding"                 contract="Microsoft.ServiceModel.Samples.IQuoteChange"> </endpoint>    </client>    <bindings>       <netPeerTcpBinding> <!-- Default security is password-based, check message integrity -->          <binding configurationName=“QuoteSenderBinding" port="7001" messageAuthentication="true" />       </netPeerTcpBinding>    </bindings> </system.serviceModel>

  24. Stock Quote DistributionSender.Cs // Create a channel factory with the configuration ChannelFactory<IQuoteChannel> cf = new ChannelFactory<IQuoteChannel>(“QuoteSenderEndpoint"); // Specify mesh password, certificate for secure connections PeerSecurityBehavior security = new PeerSecurityBehavior(); security.Password = args[0]; X509Certificate2 selfCredentials = GetCertificate(StoreName.My, StoreLocation.CurrentUser, recognizedSender, X509FindType.FindBySubjectDistinguishedName); security.SetSelfCertificate(selfCredentials); // 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. cf.Description.Behaviors.Add(security); // Create proxy from channel factory and open it IQuoteChannel sender = (IQuoteChannel)cf.CreateChannel(); sender.Open(); // Start sending stock quotes using this proxy sender.PriceChange(“ABCY”,-0.50, 99.50);

  25. Stock Quote DistributionReceiver service contract <add key="baseAddress" value="net.p2p://FreeQuotes" /> <system.serviceModel>    <services>        <!-- Broadcast receiver -->       <service type="Microsoft.ServiceModel.Samples.QuoteReceiver">           <!-- use base address provided by the host -->          <endpoint address="Stocks"                    binding="netPeerTcpBinding"                    bindingConfiguration=“QuoteReceiverBinding"                    contract="Microsoft.ServiceModel.Samples.IQuoteChange" />       </service>    </services>    <bindings>       <netPeerTcpBinding>          <binding configurationName=“QuoteReceiverBinding" port="6001" messageAuthentication="true" />       </netPeerTcpBinding>    </bindings> </system.serviceModel>

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

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

  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. 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 • Newsgroups • microsoft.public.win32.programmer.networks • microsoft.public.platformsdk.networking • microsoft.public.platformsdk.networking.ipv6 • Blogs • 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.

More Related