1 / 31

Peer-to-Peer Programming with .NET 3.5

Peer-to-Peer Programming with .NET 3.5. Dean Fiala Very Practical Software vpsw.com. What We’ll Cover. Windows Peer-to-Peer Overview System.Net.PeerToPeer Namespace Tour Hot Peer-to-Peer Action (demo) Peek at other .NET Peer-to-Peer technologies. First Pier-to-Pier Network.

admon
Download Presentation

Peer-to-Peer Programming with .NET 3.5

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. Peer-to-Peer Programming with .NET 3.5 Dean Fiala Very Practical Software vpsw.com

  2. What We’ll Cover • Windows Peer-to-Peer Overview • System.Net.PeerToPeer Namespace Tour • Hot Peer-to-Peer Action (demo) • Peek at other .NET Peer-to-Peer technologies

  3. First Pier-to-Pier Network

  4. Overview of Peer-To-Peer Networking • Simply a collection of peers • Peers act as both clients and servers • Pure P2P -- No central server required (DNS-less) • Hybrid P2P – server used to helped find peers • Based on IPv6 (allows every device on the network to have a unique address)

  5. Uses of P2P • File Sharing • Collaboration • Chatting • Distributed Processing

  6. P2P Cloud • Simply a collection of peers within a defined network scope • Peer can belong to multiple clouds • Sometimes known as a Mesh Network

  7. Cloud Scope Global all peers on the Internet Link Localall peers on the local subnet

  8. Cloud Status Virtual Not yet initialized Synchronizing Still initializing (bootstrapping) Active Ready to go Alone Ready to go – but not connected to any other system

  9. Peer Name • Defined as Authority.Classifer • Authority.FriendlyName • For unsecured names, Authority = 0ex: 0.Fredo • For secured names, Authority = SHA1 Hash of the PeerName ex: 259ef61ae2a6703fed18544a268204adba477735.Sonny

  10. Peer Name Resolution Protocol • PNRP • Secret sauce – allows peers to find each other without servers • Real time – no caching like DNS • Resolves Peer Names, which define Endpoints for communication

  11. Peer Resolution In Cache? AskClosest Peer Find Peer No In Cache? Send to RequestingPeer In Cache? Ask NextClosest Peer Yes No AskSuggested Yes CloserPeer? Ask This One No Sorry In Cache?

  12. PNRP v1 vs PNRP v2 • NOT COMPATIBLE • PNRP v1 (XP SP2 or lower) • Recursive search • PNRP v2 (Vista, XP SP3) • Iterative search • v2 patch available for XP SP2, http://support.microsoft.com/kb/920342KILLS v1 dependent apps

  13. Useful Tools • NETSH – Command Line utility to diagnose or set up a computer’s networking configuration • Teredo – Tunneling Technology allows IPv6 traffic over IPv4 networks

  14. Useful NETSH Commands • p2p pnrp cloud show names – shows names of registered peers • p2p pnrp cloud show list – shows status of clouds • p2p pnrp peer add registration – quickly add a peer to clouds for testing purposes

  15. Peer To Peer in .NET • First available in .NET 3.5 • Classes live in the System.Net.PeerToPeer namespace • Two purposes: • Registering peers in clouds • Resolving peers in clouds

  16. System Requirements • Vista • XP SP2, SP3 • XP SP1 and the Advanced Networking Pack for Windows XP • Server 2008

  17. Services Required • Peer Name Resolution Protocol • Peer Network Identity Manager • SSDP – Simple Service Discovery Protocol

  18. Endpoint PeerNameRecord 0.Somename Registering A Peer PeerName +

  19. Creating a PeerName • (string, PeerNameType) constructor creates fully qualified PeerName in format Authority.Classifier • Type = Unsecured creates 0.{FriendlyName} • Type = Secured creates {Hash}.{FriendlyName}

  20. What’s an Endpoint? • An Internet Protocol address and port • Can be IPv4 or IPv6 • Implemented as System.Net.IPEndPoint

  21. Why Define Endpoints? • No way to find out from .NET classes what the Registered end point is if UseAutoEndpointSelection = true

  22. How To Get A Cloud • Cloud.GetAvailableClouds() returns a collection of available clouds for the peer • Should return: • One Global Cloud • Plus one LinkLocal cloud for each active network adapter

  23. PeerNameRecord 0.Somename Resolving A Peer Resolver PeerName

  24. PeerNameRecord • Information about a peer within a given cloud fe80::3044:488f:11b2:c2d4%10 PeerNameRecord 0.Somename Some Comment Some Data (up to 4K)

  25. Hot Peer-To-Peer Action • Another P2P Chat Application!

  26. Net.PeerToPeer.Collaboration • Only available in Vista  • Not in Server 2008 either • Framework to handle: • Discovery • Notification • Invitations • Contact Lists • Groups • Beaucoup event hooks available

  27. Exciting Collaboration Classes • PeerCollaboration: duh, need to use this to access almost everything else • ContactManager: access to contacts in an address book • PeerApplication: an application that be shared • PeerPresence: shows the status of a peer

  28. WCF Peer Channel • Built-in goodies for creating p2p applications • Handles most of the plumbing • Has PeerNodes, PeerMeshes and uses the PNRP Resolver • Good starting point for p2p apps not tied to Vista • Same requirements as using the PeerToPeer namespace

  29. What We Covered • Peer-to-Peer Overview • Tour of the System.Net.PeerToPeer Namespace • Hot Peer-to-Peer Action (demo) • Peek at other .NET Peer-to-Peer technologies

  30. Resources • Good Overview: http://msdn.microsoft.com/en-us/library/cc297274.aspx • PNRP v2 Update for XP: http://support.microsoft.com/default.aspx/kb/920342 • P2P Blog: http://blogs.msdn.com/p2p/default.aspx • NETSH: http://technet2.microsoft.com/windowsserver/en/library/61427fbd-de1f-4c8a-b613-321f7a3cca6a1033.mspx?mfr=true • WCF PeerChannel: http://msdn.microsoft.com/en-us/library/ms731061.aspx

  31. Contact Info & Shameless Plug • Email: dfiala@vpsw.com or dfiala@gmail.com • Blog: www.vpsw.com/blogbaby meets the Second Wednesday of every monthwww.rocknug.org

More Related