logging in or signing up Sandeep Singhal USC 20050927 P2P Overview Mentor Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 580 Category: Product Traini.. License: All Rights Reserved Like it (2) Dislike it (0) Added: June 19, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Developing P2P Applications inWindows XP, Windows Vista, and Windows Communication Foundation: Developing P2P Applications in Windows XP, Windows Vista, and Windows Communication Foundation Sandeep K. Singhal Fred Fourie Product Unit Manager Senior Development Engineer Microsoft Corporation Microsoft Corporation Agenda: Agenda Gaming: From Client-Server to Peer-to-Peer How Microsoft is enabling P2P P2P application lifecycle Identify Organize Communicate Resources Networking Requirements: Connectivity Across NATs and Firewalls Name Resolution Across changing IP addresses Multiparty Communication Replication and Synchronization Security Networking Requirements Collaboration Requirements: Collaboration Requirements Contact List Who are my contacts that I play regularly with Presence Status Are my contacts online, busy, offline? Game Availability Does my contact have the game I want to play Invite Can I invite my contact into the game I want to play LAN parties Can I organize a LAN party, where people find each other on the local network and play with each other Security Today’s World: Use Servers: Today’s World: Use Servers Servers act as relays for clients behind NATs, Firewalls Servers act as name resolution arbiters Servers enable rendezvous for multiparty games, and then forward traffic Servers act as the central security point for a game Today’s World: Use Servers: Today’s World: Use Servers Contact List Servers maintain a gamer’s contact list Servers maintain a general list of all people who are interested in playing a game Presence status Servers forward presence information to a user’s contacts Game availability Users browse into a server-hosted lobby where there are other user’s who have the same game Today’s World: Use Servers: Today’s World: Use Servers Invite Servers forward an invitation for a game from a user to a contact Servers also forward any data in the invitation to the contact Security Servers act as central CA’s or have a simpler security mechanism as needed LAN parties A single machine set up as a server on the LAN Server Overload: Server Overload What is Peer-to-Peer (P2P)?: 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 Why Use P2P?: 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 Addressing P2P Challenges: 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 Three Platforms: Three Platforms Windows XPSP2 Win32 API: PNRP, Graphing/Grouping (mesh) Windows Vista Win32 API: PNRP, Graphing/Grouping (mesh), Contacts, Invitation, People Near Me, Serverless Presence Windows Communication Foundation Available on both XPSP2 and Vista C# API: Peer Channel (mesh) Public wrappers available for XPSP2 features P2P Collaboration Platform in Windows Vista: P2P Collaboration Platform in Windows Vista Contact / Cert. Store Publication Invite Auth People Near Me P2P (Internet) Multi-Party Mesh (Graphing/Grouping, Peer Channel) PNRP IPv6, Teredo NAT Traversal Application P2P Application Operations: P2P Application Operations Find peer Send invitation Create session One-to-One P2P Application Operations: P2P Application Operations Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many P2P Application Operations: P2P Application Operations Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many 1. Find Peers: 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 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-One One-to-Many Many-to-Many Contacts: Each user has a Me contact Created on first use of p2p infrastructure Associated with certificate UI popped requesting user for some basic information Other contacts stored in Windows Address Book Each associated with certificate Contacts People Near Me: Enumerate the people on the same subnet Requires people to explicitly opt in to being visible to people on the subnet Once opted in, a nickname is published on the network Additional information that can be retrieved 'Objects' published by running applications 'Capabilities' describing installed applications that can receive invitations People Near Me Capabilities: Capabilities Applications registered to be invite-able PEER_CAPABILITY *pCapability pCapability-andgt;Guid = 'andlt;insert guid'andgt; pCapability-andgt;Description = 'HL2!' pCapability-andgt;Path = 'C:\Program Files\HL2\HL2.exe' PeerCollabRegisterCapability(pCapability); Objects: Objects Run-time application specific information that can be sent to contacts Examples include sending game settings, player levels for a given game, icons etc PEER_OBJECT *pObject; pObject-andgt;Guid = 'Insert guid'; pObject-andgt;Data = andlt;Insert Peer_Dataandgt;; PeerCollabSetObject(pObject); Peer Name Resolution Protocol: 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 PNRP Names: PNRP Names Authority Classifier . Hash of public key (0 for insecure name) Application-provided string Hash Peer ID Distributed Hash Table: Distributed Hash Table 0,2^128 PNRP Resolve Illustration: 100 200 800 450 500 350 100 tries to Resolve ID 800. Has 200 in cache 1 2 200 forwards RESOLVE to neighbor closest to 800 3 500 Can’t get closer, so rejects RESOLVE back to 200 4 200 forwards RESOLVE to next closest neighbor to 800 5 450 forwards RESOLVE to 800 6 800 matches target. Converts RESOLVE to RESPONSE, and forwards along request path PNRP Resolve Illustration Accessing PNRP: Accessing PNRP PNRP API DNS encoding of PNRP names *.pnrp.net Works with standard getaddrinfo(), System.net for resolution PNRP Examples: PNRP Examples // 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, andamp;hReg); hr = PeerPnrpResolve('0.SandeepPictures', NULL, andamp;cEndpoints, andamp;pEndpoints); PWSTR pwzHostName = NULL; HRESULT hr = PeerNameToPeerHostName(L'0.SandeepPictures', andamp;pwzHostName); if (SUCCEEDED(hr)) { ADDRINFO *pai, ai = {0}; ai.ai_family = AF_INET6; getaddrinfo(pwzHostName, NULL, andamp;ai, andamp;pai); PeerFreeData(pwzHostName); } Serverless Presence: Serverless Presence Internet-based presence for Contacts Uses PNRP to locate Access status, capability, and object data PNRP Enables P2P Photo Sharing: PNRP Enables P2P Photo Sharing 2. Send Invitation: 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 If the player accepts, the associated game is launched, and any data in the invitation is passed along A response sent back to the sender stating the request was accepted/declined/timed out Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many 3. Join Mesh: 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-One One-to-Many Many-to-Many How P2P Meshes Work: 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 Two Flavors of Mesh: Two Flavors of Mesh Data replication: Graphing/Grouping Available in Windows Vista and XPSP2 Replicated database among mesh members Can be used to exchange messages Graphing: Basic mesh Grouping: Adds node discovery + security Messaging: Peer Channel Part of Windows Communication Foundation Flood messages to mesh members Can build data replication and other services Comparing Mesh Options: Comparing Mesh Options Peer Channel Graphing/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 Node Discovery Password Group certificates (managed by mesh) Password Individual certificates (managed by app.) Security APIs Native Managed Key Apps Group collaboration Content distribution Crossfire Game Using the Peer Channel: Crossfire Game Using the Peer Channel Graph Chat: Graph Chat Graphing with PNRP: 'World_Of_Fable' Register graph with PNRP Create graph [0.World_Of_Fable] Open graph Discover existing PNRP entries Resolve PNRP name to IPv6 Address Connect to Graph Found? [0.World_Of_Fable] ? 'World_Of_Fable' [0.World_Of_Fable] = 2001:4898:28:3:58b6:a8ca:cf28:xxxx Replicate Data T F Graphing with PNRP Registering a PNRP address: Registering a PNRP address // Use a NodeInfo struct obtained from graph to register graph address(es) hr = PnrpRegister(pwzP2p_Id, pwzPRNP_Id, NULL, pNodeInfo); if (SUCCEEDED(hr)) { // Use pwzPRNP_Id on remote nodes to discover this graph node. } Resolving a PNRP address // generate the unsecured PeerName [0.World_Of_Fable] hr = PeerCreatePeerName(NULL, wzGraphId, andamp;pwzPNRP_Id); PEER_ADDRESS *pPeerAddress; ZeroMemory(pPeerAddress, sizeof(PEER_ADDRESS)); pPeerAddress-andgt;dwSize = sizeof(PEER_ADDRESS); // Resolve a PNRP identity to an IPv6 address struct hr = PnrpResolve(pwzPNRP_Id, NULL, andamp;pPeerAddress-andgt;sin6); Graphing and Peer Channel: Graphing and Peer Channel Structured data replication Arbitrary payloads Message distribution Smaller payloads Graphing Peer Channel Graphing is well suited for distributing large payloads to all clients within the mesh topology. Example: propagating 3D meshes, textures, etc. to all clients loading a new level. Peer Channel is well suited for small, fast messages that need to be communicated throughout the mesh. Example: communicating the new position/orientation of a player to all clients sharing a death match. Graphing and PeerChannel: Graphing and PeerChannel Message distribution mesh (PeerChannel) Content distribution mesh (Graphing) Stock Quote Distribution Using the Peer Channel: Stock Quote Distribution Using the Peer Channel Future DirectionsBeyond Windows Vista and WCF: 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 Summary: Cert. Store Summary Contact Store Presence Invite Auth People Near Me Internet Graphing, Grouping PNRP IPv6, Teredo NAT Traversal Application Peer Channel Multi-Party Mesh Windows Vista WinFX (Windows XPSP2 and Vista) Windows XPSP2, Vista; C# wrappers Community Resources: Community Resources E-mail: Sandeep.Singhal@microsoft.com ffourie@microsoft.com Feedback/Questions: peerfb@microsoft.com Websites http://www.microsoft.com/p2p http://www.microsoft.com/ipv6 MSDN 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 http://blogs.msdn.com/ravirao/ Slide45: © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. Backup: Backup Contracts and Messages: 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 Contracts: Contracts [ServiceInterface] public interface IQuoteChange { [ServiceMethod] void PriceChange (Quote quote); } [Service] public class QuoteHandler : IQuoteChange { public void PriceChange(Quote quote) { // update quote display component; } } Stock Quote DistributionThe Message Interface: Stock Quote Distribution The 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 { } Stock Quote DistributionSender Service Contract: Stock Quote Distribution Sender Service Contract andlt;system.serviceModelandgt; andlt;clientandgt; andlt;!– A (broadcast) Peer Channel, using TCP (see below --andgt; andlt;endpoint configurationName='QuoteSenderEndpoint' address='net.p2p://FreeQuotes/Stocks' binding='netPeerTcpBinding' bindingConfiguration='QuoteSenderBinding' contract='Microsoft.ServiceModel.Samples.IQuoteChange'andgt; andlt;/endpointandgt; andlt;/clientandgt; andlt;bindingsandgt; andlt;netPeerTcpBindingandgt; andlt;!-- Default security is password-based, check message integrity --andgt; andlt;binding configurationName='QuoteSenderBinding' port='7001' messageAuthentication='true' /andgt; andlt;/netPeerTcpBindingandgt; andlt;/bindingsandgt; andlt;/system.serviceModelandgt; Stock Quote Distributionsender.cs: Stock Quote Distribution sender.cs // Create a channel factory with the configuration ChannelFactoryandlt;IQuoteChannelandgt; cf = new ChannelFactoryandlt;IQuoteChannelandgt;('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); Stock Quote DistributionReceiver Service Contract: Stock Quote Distribution Receiver Service Contract andlt;add key='baseAddress' value='net.p2p://FreeQuotes' /andgt; andlt;system.serviceModelandgt; andlt;servicesandgt; andlt;!-- Broadcast receiver --andgt; andlt;service type='Microsoft.ServiceModel.Samples.QuoteReceiver'andgt; andlt;!-- use base address provided by the host --andgt; andlt;endpoint address='Stocks' binding='netPeerTcpBinding' bindingConfiguration='QuoteReceiverBinding' contract='Microsoft.ServiceModel.Samples.IQuoteChange' /andgt; andlt;/serviceandgt; andlt;/servicesandgt; andlt;bindingsandgt; andlt;netPeerTcpBindingandgt; andlt;binding configurationName='QuoteReceiverBinding' port='6001' messageAuthentication='true' /andgt; andlt;/netPeerTcpBindingandgt; andlt;/bindingsandgt; andlt;/system.serviceModelandgt; Stock Quote Distributionreceiver.cs: Stock Quote Distribution receiver.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(); Please Read (hidden slide): Please Read (hidden slide) This template uses Microsoft’s corporate font, Segoe Segoe is not a standard font included with Windows, so if you have not already done so, you need to install it on your computer How to install Segoe: Get the font at: \\Showsrus\images\Corporate_Fonts\PC\Segoe or https://mediabank.partners.extranet.microsoft.com For PowerPoint, choose the PC OpenType or TrueType version of the font. Copy all the .ttf files into your c:\windows\fonts folder Questions: email slides@microsoft.com You do not have the permission to view this presentation. In order to view it, please contact the author of the presentation.
Sandeep Singhal USC 20050927 P2P Overview Mentor Download Post to : URL : Related Presentations : Share Add to Flag Embed Email Send to Blogs and Networks Add to Channel Uploaded from authorPOINT Insert YouTube videos in PowerPont slides with aS Desktop Copy embed code: (To copy code, click on the text box) Embed: URL: Thumbnail: WordPress Embed Customize Embed The presentation is successfully added In Your Favorites. Views: 580 Category: Product Traini.. License: All Rights Reserved Like it (2) Dislike it (0) Added: June 19, 2007 This Presentation is Public Favorites: 0 Presentation Description No description available. Comments Posting comment... Premium member Presentation Transcript Developing P2P Applications inWindows XP, Windows Vista, and Windows Communication Foundation: Developing P2P Applications in Windows XP, Windows Vista, and Windows Communication Foundation Sandeep K. Singhal Fred Fourie Product Unit Manager Senior Development Engineer Microsoft Corporation Microsoft Corporation Agenda: Agenda Gaming: From Client-Server to Peer-to-Peer How Microsoft is enabling P2P P2P application lifecycle Identify Organize Communicate Resources Networking Requirements: Connectivity Across NATs and Firewalls Name Resolution Across changing IP addresses Multiparty Communication Replication and Synchronization Security Networking Requirements Collaboration Requirements: Collaboration Requirements Contact List Who are my contacts that I play regularly with Presence Status Are my contacts online, busy, offline? Game Availability Does my contact have the game I want to play Invite Can I invite my contact into the game I want to play LAN parties Can I organize a LAN party, where people find each other on the local network and play with each other Security Today’s World: Use Servers: Today’s World: Use Servers Servers act as relays for clients behind NATs, Firewalls Servers act as name resolution arbiters Servers enable rendezvous for multiparty games, and then forward traffic Servers act as the central security point for a game Today’s World: Use Servers: Today’s World: Use Servers Contact List Servers maintain a gamer’s contact list Servers maintain a general list of all people who are interested in playing a game Presence status Servers forward presence information to a user’s contacts Game availability Users browse into a server-hosted lobby where there are other user’s who have the same game Today’s World: Use Servers: Today’s World: Use Servers Invite Servers forward an invitation for a game from a user to a contact Servers also forward any data in the invitation to the contact Security Servers act as central CA’s or have a simpler security mechanism as needed LAN parties A single machine set up as a server on the LAN Server Overload: Server Overload What is Peer-to-Peer (P2P)?: 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 Why Use P2P?: 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 Addressing P2P Challenges: 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 Three Platforms: Three Platforms Windows XPSP2 Win32 API: PNRP, Graphing/Grouping (mesh) Windows Vista Win32 API: PNRP, Graphing/Grouping (mesh), Contacts, Invitation, People Near Me, Serverless Presence Windows Communication Foundation Available on both XPSP2 and Vista C# API: Peer Channel (mesh) Public wrappers available for XPSP2 features P2P Collaboration Platform in Windows Vista: P2P Collaboration Platform in Windows Vista Contact / Cert. Store Publication Invite Auth People Near Me P2P (Internet) Multi-Party Mesh (Graphing/Grouping, Peer Channel) PNRP IPv6, Teredo NAT Traversal Application P2P Application Operations: P2P Application Operations Find peer Send invitation Create session One-to-One P2P Application Operations: P2P Application Operations Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many P2P Application Operations: P2P Application Operations Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many 1. Find Peers: 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 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-One One-to-Many Many-to-Many Contacts: Each user has a Me contact Created on first use of p2p infrastructure Associated with certificate UI popped requesting user for some basic information Other contacts stored in Windows Address Book Each associated with certificate Contacts People Near Me: Enumerate the people on the same subnet Requires people to explicitly opt in to being visible to people on the subnet Once opted in, a nickname is published on the network Additional information that can be retrieved 'Objects' published by running applications 'Capabilities' describing installed applications that can receive invitations People Near Me Capabilities: Capabilities Applications registered to be invite-able PEER_CAPABILITY *pCapability pCapability-andgt;Guid = 'andlt;insert guid'andgt; pCapability-andgt;Description = 'HL2!' pCapability-andgt;Path = 'C:\Program Files\HL2\HL2.exe' PeerCollabRegisterCapability(pCapability); Objects: Objects Run-time application specific information that can be sent to contacts Examples include sending game settings, player levels for a given game, icons etc PEER_OBJECT *pObject; pObject-andgt;Guid = 'Insert guid'; pObject-andgt;Data = andlt;Insert Peer_Dataandgt;; PeerCollabSetObject(pObject); Peer Name Resolution Protocol: 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 PNRP Names: PNRP Names Authority Classifier . Hash of public key (0 for insecure name) Application-provided string Hash Peer ID Distributed Hash Table: Distributed Hash Table 0,2^128 PNRP Resolve Illustration: 100 200 800 450 500 350 100 tries to Resolve ID 800. Has 200 in cache 1 2 200 forwards RESOLVE to neighbor closest to 800 3 500 Can’t get closer, so rejects RESOLVE back to 200 4 200 forwards RESOLVE to next closest neighbor to 800 5 450 forwards RESOLVE to 800 6 800 matches target. Converts RESOLVE to RESPONSE, and forwards along request path PNRP Resolve Illustration Accessing PNRP: Accessing PNRP PNRP API DNS encoding of PNRP names *.pnrp.net Works with standard getaddrinfo(), System.net for resolution PNRP Examples: PNRP Examples // 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, andamp;hReg); hr = PeerPnrpResolve('0.SandeepPictures', NULL, andamp;cEndpoints, andamp;pEndpoints); PWSTR pwzHostName = NULL; HRESULT hr = PeerNameToPeerHostName(L'0.SandeepPictures', andamp;pwzHostName); if (SUCCEEDED(hr)) { ADDRINFO *pai, ai = {0}; ai.ai_family = AF_INET6; getaddrinfo(pwzHostName, NULL, andamp;ai, andamp;pai); PeerFreeData(pwzHostName); } Serverless Presence: Serverless Presence Internet-based presence for Contacts Uses PNRP to locate Access status, capability, and object data PNRP Enables P2P Photo Sharing: PNRP Enables P2P Photo Sharing 2. Send Invitation: 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 If the player accepts, the associated game is launched, and any data in the invitation is passed along A response sent back to the sender stating the request was accepted/declined/timed out Find peer Send invitation Create session Learn mesh name Join mesh One-to-One One-to-Many Many-to-Many 3. Join Mesh: 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-One One-to-Many Many-to-Many How P2P Meshes Work: 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 Two Flavors of Mesh: Two Flavors of Mesh Data replication: Graphing/Grouping Available in Windows Vista and XPSP2 Replicated database among mesh members Can be used to exchange messages Graphing: Basic mesh Grouping: Adds node discovery + security Messaging: Peer Channel Part of Windows Communication Foundation Flood messages to mesh members Can build data replication and other services Comparing Mesh Options: Comparing Mesh Options Peer Channel Graphing/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 Node Discovery Password Group certificates (managed by mesh) Password Individual certificates (managed by app.) Security APIs Native Managed Key Apps Group collaboration Content distribution Crossfire Game Using the Peer Channel: Crossfire Game Using the Peer Channel Graph Chat: Graph Chat Graphing with PNRP: 'World_Of_Fable' Register graph with PNRP Create graph [0.World_Of_Fable] Open graph Discover existing PNRP entries Resolve PNRP name to IPv6 Address Connect to Graph Found? [0.World_Of_Fable] ? 'World_Of_Fable' [0.World_Of_Fable] = 2001:4898:28:3:58b6:a8ca:cf28:xxxx Replicate Data T F Graphing with PNRP Registering a PNRP address: Registering a PNRP address // Use a NodeInfo struct obtained from graph to register graph address(es) hr = PnrpRegister(pwzP2p_Id, pwzPRNP_Id, NULL, pNodeInfo); if (SUCCEEDED(hr)) { // Use pwzPRNP_Id on remote nodes to discover this graph node. } Resolving a PNRP address // generate the unsecured PeerName [0.World_Of_Fable] hr = PeerCreatePeerName(NULL, wzGraphId, andamp;pwzPNRP_Id); PEER_ADDRESS *pPeerAddress; ZeroMemory(pPeerAddress, sizeof(PEER_ADDRESS)); pPeerAddress-andgt;dwSize = sizeof(PEER_ADDRESS); // Resolve a PNRP identity to an IPv6 address struct hr = PnrpResolve(pwzPNRP_Id, NULL, andamp;pPeerAddress-andgt;sin6); Graphing and Peer Channel: Graphing and Peer Channel Structured data replication Arbitrary payloads Message distribution Smaller payloads Graphing Peer Channel Graphing is well suited for distributing large payloads to all clients within the mesh topology. Example: propagating 3D meshes, textures, etc. to all clients loading a new level. Peer Channel is well suited for small, fast messages that need to be communicated throughout the mesh. Example: communicating the new position/orientation of a player to all clients sharing a death match. Graphing and PeerChannel: Graphing and PeerChannel Message distribution mesh (PeerChannel) Content distribution mesh (Graphing) Stock Quote Distribution Using the Peer Channel: Stock Quote Distribution Using the Peer Channel Future DirectionsBeyond Windows Vista and WCF: 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 Summary: Cert. Store Summary Contact Store Presence Invite Auth People Near Me Internet Graphing, Grouping PNRP IPv6, Teredo NAT Traversal Application Peer Channel Multi-Party Mesh Windows Vista WinFX (Windows XPSP2 and Vista) Windows XPSP2, Vista; C# wrappers Community Resources: Community Resources E-mail: Sandeep.Singhal@microsoft.com ffourie@microsoft.com Feedback/Questions: peerfb@microsoft.com Websites http://www.microsoft.com/p2p http://www.microsoft.com/ipv6 MSDN 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 http://blogs.msdn.com/ravirao/ Slide45: © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. Backup: Backup Contracts and Messages: 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 Contracts: Contracts [ServiceInterface] public interface IQuoteChange { [ServiceMethod] void PriceChange (Quote quote); } [Service] public class QuoteHandler : IQuoteChange { public void PriceChange(Quote quote) { // update quote display component; } } Stock Quote DistributionThe Message Interface: Stock Quote Distribution The 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 { } Stock Quote DistributionSender Service Contract: Stock Quote Distribution Sender Service Contract andlt;system.serviceModelandgt; andlt;clientandgt; andlt;!– A (broadcast) Peer Channel, using TCP (see below --andgt; andlt;endpoint configurationName='QuoteSenderEndpoint' address='net.p2p://FreeQuotes/Stocks' binding='netPeerTcpBinding' bindingConfiguration='QuoteSenderBinding' contract='Microsoft.ServiceModel.Samples.IQuoteChange'andgt; andlt;/endpointandgt; andlt;/clientandgt; andlt;bindingsandgt; andlt;netPeerTcpBindingandgt; andlt;!-- Default security is password-based, check message integrity --andgt; andlt;binding configurationName='QuoteSenderBinding' port='7001' messageAuthentication='true' /andgt; andlt;/netPeerTcpBindingandgt; andlt;/bindingsandgt; andlt;/system.serviceModelandgt; Stock Quote Distributionsender.cs: Stock Quote Distribution sender.cs // Create a channel factory with the configuration ChannelFactoryandlt;IQuoteChannelandgt; cf = new ChannelFactoryandlt;IQuoteChannelandgt;('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); Stock Quote DistributionReceiver Service Contract: Stock Quote Distribution Receiver Service Contract andlt;add key='baseAddress' value='net.p2p://FreeQuotes' /andgt; andlt;system.serviceModelandgt; andlt;servicesandgt; andlt;!-- Broadcast receiver --andgt; andlt;service type='Microsoft.ServiceModel.Samples.QuoteReceiver'andgt; andlt;!-- use base address provided by the host --andgt; andlt;endpoint address='Stocks' binding='netPeerTcpBinding' bindingConfiguration='QuoteReceiverBinding' contract='Microsoft.ServiceModel.Samples.IQuoteChange' /andgt; andlt;/serviceandgt; andlt;/servicesandgt; andlt;bindingsandgt; andlt;netPeerTcpBindingandgt; andlt;binding configurationName='QuoteReceiverBinding' port='6001' messageAuthentication='true' /andgt; andlt;/netPeerTcpBindingandgt; andlt;/bindingsandgt; andlt;/system.serviceModelandgt; Stock Quote Distributionreceiver.cs: Stock Quote Distribution receiver.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(); Please Read (hidden slide): Please Read (hidden slide) This template uses Microsoft’s corporate font, Segoe Segoe is not a standard font included with Windows, so if you have not already done so, you need to install it on your computer How to install Segoe: Get the font at: \\Showsrus\images\Corporate_Fonts\PC\Segoe or https://mediabank.partners.extranet.microsoft.com For PowerPoint, choose the PC OpenType or TrueType version of the font. Copy all the .ttf files into your c:\windows\fonts folder Questions: email slides@microsoft.com