Download presentation
Presentation is loading. Please wait.
Published byMarybeth Byrd Modified over 9 years ago
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 Local all peers on the local subnet
8
Cloud Status VirtualNot yet initialized SynchronizingStill initializing (bootstrapping) ActiveReady to go AloneReady to go – but not connected to any other system
9
Peer Name Defined as Authority.Classifer Authority.FriendlyName For unsecured names, Authority = 0 ex: 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? Find Peer No Ask Closest Peer In Cache? Yes Send to Requesting Peer No Closer Peer? No Sorry Yes Ask This One Ask Suggested In Cache? Ask Next Closest Peer 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/920342 KILLS v1 dependent apps http://support.microsoft.com/kb/920342
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
Registering A Peer PeerName Endpoint PeerNameRecord 0.Somename +
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
Resolving A Peer PeerName Resolver PeerNameRecord 0.Somename
24
PeerNameRecord Information about a peer within a given cloud PeerNameRecord 0.Somename fe80::3044:488f:11b2:c2d4%10 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.aspxhttp://msdn.microsoft.com/en- us/library/cc297274.aspx PNRP v2 Update for XP: http://support.microsoft.com/default.aspx/kb/920342 http://support.microsoft.com/default.aspx/kb/920342 P2P Blog: http://blogs.msdn.com/p2p/default.aspxhttp://blogs.msdn.com/p2p/default.aspx NETSH: http://technet2.microsoft.com/windowsserver/en/library/6 1427fbd-de1f-4c8a-b613- 321f7a3cca6a1033.mspx?mfr=true http://technet2.microsoft.com/windowsserver/en/library/6 1427fbd-de1f-4c8a-b613- 321f7a3cca6a1033.mspx?mfr=true WCF PeerChannel: http://msdn.microsoft.com/en- us/library/ms731061.aspxhttp://msdn.microsoft.com/en- us/library/ms731061.aspx
31
Contact Info & Shameless Plug Email: dfiala@vpsw.com or dfiala@gmail.comdfiala@vpsw.com dfiala@gmail.com Blog: www.vpsw.com/blogbabywww.vpsw.com/blogbaby meets the Second Wednesday of every month www.rocknug.org www.rocknug.org
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.