SlideShare ist ein Scribd-Unternehmen logo
1 von 41
P2P and .NET:
a walk-through
Giuliana Carullo - Luca Pepe
Daniele Valenza
Distributed Systems Course
University of Salerno
2012/2013
OUTLINE
 Overview of Microsoft Windows P2P
Networking.
 A P2P application development
introduction with .Net and WCF.
P2P definitions
Cloud
peerID
(meshID)
.
.
.
peerID
(meshID)
Mesh
address
scope PNRP
Dynamic DNS could be an alternative to PNRP… but
is not the best solution given the transient nature of
the mesh (NAT issues)
P2P Application Flow
There are three types of P2P application:
 one-to-one
 one-to-many
 many-to-many
When one peer in a mesh wants to
communicate three steps must be
performed:
 Find peer (PNRP or People Near Me)
 Send invitation
 Join mesh
PNRP
Peer Name Resolution Protocol (PNRP) is a peer-to-
peer protocol designed by Microsoft that enables
dynamic name publication and resolution.
 Two version are available:
 PNRP version 1 was included in Windows XP SP2, Windows
XP Professional x64 Edition, and Windows XP SP1 with the
Advanced Networking Pack for Windows XP
 PNRP version 2 was released with Windows Vista, and was
made available to Windows XP SP2 users through a
separate download. Windows 7 and Windows 8 also uses
version 2.
Version 1 and version 2 of PNRP are not compatible.
We cover only version 2
PNRP
Key attributes:
 Distributed and serverless: each peer caches a
portion of the list of names on the mesh and further
refers to other.
 IDs are used: names are language-dependent.
 Multiple IDs: Each service on the mesh has its own
identifier, thus every node may have one or more IDs.
 Scalable ID management: the growing list of IDs is
managed using a multilevel cache and referral
system based on DHT (Chord-Pastry-like)
PNRP ID
A peer name is an endpoint for communication,
which can be a computer, a user, a group, a service,
or anything else that you want to resolve to an IPv6
address (IPv4 compatible).
Peer names can be registered as:
 Secured: Protected with certificate and digital
signature.
 Unsecured: Recommended for use in private
network only (names can easily be spoofed).
PNRP ID structure
Public Key
Hash
authority.classifier
Friendly Name (≤ 150 char)
(128 bits) Service Location (128 bits)
Hash
P2P ID
PNRP ID
Secured PNRP ID
Cloud
pn1
.
.
.
pnN
DHT
PNRP ID
Certified Peer Address
IPv6 Address
The Certified Peer Address (CPA) is a self-signed certificate
that provides authentication protection for the PNRP ID and
contains application endpoint information such as
addresses, protocol numbers, and port numbers.
PNRP Clouds
grouping of computers that are able to find each other.
PNRP provides two type of clouds:
 Global cloud the global IPv6 address scope and
global addresses and represents all the computers on
the entire IPv6 Internet. There is only a single global
cloud.
 Link-local cloud A link-local cloud is for a specific link,
which is typically the same as the locally attached
subnet. There can be multiple link-local clouds.
PNRP – Peer resolution
(cache hit)
pr
local
cache
lookup
pt
IPv6 pt
Req. Message
Resp. Message
1
2
lookup (closest(pt)=pi))
IPv6
PNRP – Peer resolution
(cache miss)
pr
local
cache
pt
pi
Req. Message
Resp. Message
1
2
3
Iterate step 2
until pt is found
PNRP Cache Initialization
Three methods are executed at start up:
 Persistent cache entries: Reload from hard-disk
cached entries stored before shutdown
 PNRP seed nodes: PNRP allows administrators to
specify the addresses or DNS names of PNRP seeds
nodes
 Simple Service Discovery Protocol: PNRP nodes are
required to register themselves using the Universal
Plug-and-Play (UPnP) Simple Service Discovery
Protocol (SSDP).
PNRP Name Publication
pr
NEIGHBORS
RAND
NODES
local
cache put
1
2
3
put 3
OUTLINE
 OVERVIEW OF P2P APPLICATIONS USING
WCF AND .NET
 A DEVELOPER’S INTRODUCTION TO P2P
APPLICATION DEVELOPMENT
.Net Framework 4.5
Windows
Presentation
Foundation
Windows
Communication
Foundation
Base Class and
Task Parallel Library
Languages:
C# 5.0 Visual Basic 11 Visual C++ 11
Windows 8
Support
ASP. Net
Windows
Workflow Foundation
ADO .NET
Windows
Extensibility
Framework
Windows Communication Foundation (WCF) is a
framework for building Distributed and Service-
Oriented Applications.
WCF
WCF: Main Features
 Service Orientation
 AJAX and REST Support
 specific XML formats (ATOM or RSS)
 non-XML formats (JSON)
 Plain XML and SOAP
 Interoperability
 Backward Compatibility (COM - COM+, .Net Remoting,
ASP.NET)
 Other non-Windows technologies
 Security (Encryption and Authentication)
 Extensibility (e.g, custom bindings, custom transport of
SOAP messages).
P2P requirements
Primary issues that must be taken into account:
 End-to-end connectivity: ensure communication
between peers, even in cases where different
technologies are adopted.
 Common foundation: identity management,
contract management, node discovery, node
naming, secure session management, multipeer
communication, and so on.
 Secure and Scalable deployment: the ability to
build on protocols specifically engineered for
large-scale deployment, and to provide built-in
security.
P2P requirements
End-to-end connectivity: ensure communication
between peers, even in cases where different
technologies are adopted.
Solved by WCF which ensures interoperability
between nodes using messages that are platform
independent (WS-* specifications)
P2P requirements
Secure and Scalable deployment: the ability to
build on protocols specifically engineered for
large-scale deployment, and to provide built-in
security
Several security levels are available:
 None: No security is required.
 Transport: No message security is implemented;
only neighbor-to-neighbor security is required.
 Message: Only message authentication is required
when communicating over an open channel.
 TransportWithMessageCredential:
Message and transport security.
P2P requirements
 Common foundation: identity management,
contract management, node discovery, node
naming, secure session management, multipeer
communication, and so on.
More details in the following.
WCF ABC Major point
Address: specifies the location of the service
and is used by the clients for communication
Binding: Specifies how a service is accessible
Contract: Used to specify what the service can do
Endpoint
Endpoint provides clients access to the
functionality offered by a WCF service and all
communication occurs through it.
Endpoint representation:
(Address, binding, contract, Behaviors)
the endpoint may be specified imperatively
using code (System.net namespace) or
declaratively through configuration.
Endpoint component
Address: The address specifies the location of the
service and is used by the clients for communication
The address's protocol that WCF can provided:
HTTP, TCP, NamedPipe, Peer2Peer, MSMQ
The Address is represented in the WCF object model
by the EndpointAddress class that contains the
following property:
 Uri: which represents the address of the service
 Identity: security identity of the service
 Headers: additional and more detailed addressing
information to identify or interact with the endpoint
Endpoint component
Bindings: The binding specifies how to
communicate with the endpoint. A binding is
represented in the WCF object model by the
abstract base class Binding.
Extending the Binding class we can specify:
 transport protocol (e.g, TCP or HTTP).
 message encoding (e.g, text or binary).
 security requirements (e.g, SSL, SOAP security)
Endpoint component
Contract Is the interface representing the
functionalities exposed by the service.
Annotations are added to the Interface in order to
define a contract:
 [ServiceContract()] is declared on the top of the
interface and defines the contract
 [OperationContract] is added to each method of
the interface and defines the relative
functionality. Three attributes may be exclusively
defined: one-way, request-reply, duplex.
Endpoint component
Behaviors: customization of the service endpoint.
Endpoint behaviors achieve this by participating in
the process of building a WCF runtime.
An example of an endpoint behavior is the ListenUri
property,which allows to specify a different listening
address than the SOAP or (WSDL) address.
Endpoint in configuration
Endpoint property can be defined in an XML file (app.config) in
which following sections are defined:
 Bindings (<bindings>): specifies an aspect of how an
endpoint communicates with the world: transports (e.g.,
HTTP, TCP) and features(Security, Reliability, Transaction flows)
 Endpoint (<endpoint>): Endpoints provide clients access to
the functionality offered by a WCF service (address, bindings,
contract, behavior)
 Services (<services>): specifications for all services the
application hosts, defining endpoints
 Client (<client>): specifies endpoints used by the application
to connect to a service
WCF P2P configuration
P2P inherits all building blocks defined for WCF services.
In particular a special binding is provided for this kind of
application:
 NetPeerTcpBinding provides support for the creation of
peer networking applications that use a TCP-level peer-
to-peer mesh infrastructure
Since nodes are peer, they must behave like service and
like client. Thus, configurations for both <services> and
<client> must be specified in the same app and they must
use the NetPeerTcpBinding binding type.
P2P configuration
Peer Node
and Peer Resolver
peer node: instance of an application that
participates in the mesh.
peer resolver: responsible for resolving a
mesh ID to the endpoint addresses of a few
nodes in the mesh. (PNRP or custom )
Mesh ID
Mesh IDs identify the host portion of the address of an
endpoint in the mesh.
Examples of these addresses are
"net.p2p://chatMesh/servicemodelsamples/chat"
"net.p2p://broadcastMesh/servicemodelsamples/announce".
chatMesh and broadcastMesh are the mesh IDs.
All clients that participate in a mesh use the same
mesh ID, but can potentially use different paths and
services.
A message addressed to a specific endpoint address
is delivered to all peer channels using that address.
Mesh network
Two types of Mesh are defined:
 Groupings: used by the Data Replication service. The
various peers in the mesh exchange messages by
replicating records containing the data.
Implementation is unmanaged (Win32 API library)
 Peer channels: a message-based service, available in
WCF (managed code)
Mesh creation
1. A peer node open a peer channel
(the status of the peer become opened)
2. Peer Node use a peer resolver (PNRP or custom)to
resolve mesh ID to the addresses of other peer
nodes to connect to.
3. Peer Node estrablish connection with theother
peers using peer channel
Now, the mesh is created and the messages can
be propagated.
Peer Channel
 automatically manages join and leave and can
have any number of participants.
 does not ensure message ordering e message
reception (Best effort).
 Prevent replicated message reception
 A connection to a neighbor might be terminated if it keeps
trying to resend a message that has been processed
previously.
Peer Channel:
Application Flow
pr pt
Network
Request Connection
Accept / Decline
Connection accepted: welcome message is sent which contain also
the list of other nodes that are part of the mesh.
Peer Channel:
Application Flow
pr pt
Network
Request Connection
Accept / Decline
Connection refused: pt sends to pr a refusal message, containing the
reason for the refusal and a list of the addresses of the other nodes in
the mesh.
WCF P2P Application
References
1. MSDN An introduction to WCF.
http://msdn.microsoft.com/en-us/library/ms731082.aspx
2. Bill Evjen, Christian Nagel, Rod Stephens Professional
ASP.NET 4, Professional C#, chapter 45 available at
http://blogs.wrox.com/files/2013/05/502259_c45_p2_ed.pd
f
3. Nishith Pathak, Pro WCF 4: Practical Microsoft SOA
Implementation, Apress, Berkley, CA, 2011
4. MSDN Binding types, http://msdn.microsoft.com/en-
us/library/ms733099.aspx
5. MSDN Defining Bindings by configuration file.
http://msdn.microsoft.com/en-us/library/ms734786.aspx
References
6. MSDN Defining Bindings by code.
http://msdn.microsoft.com/en-us/library/ms731080.aspx
7. MSDN P2P Programming with WCF, and .Net 3.5
http://msdn.microsoft.com/en-us/library/cc297274.aspx
8. MSDN Introduction to WCF 4.
http://msdn.microsoft.com/en-us/library/ee354381.aspx
9. MSDN Peer2Peer Networking.
http://msdn.microsoft.com/en-us/library/ms733761.aspx
10. MSDN Net Peer TCP. http://msdn.microsoft.com/en-
us/library/ms751426%28v=vs.85%29.aspx
11. MSDN Peer Channel Concept.
http://msdn.microsoft.com/en-us/library/ms731061.aspx

Weitere ähnliche Inhalte

Was ist angesagt?

WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)ipower softwares
 
REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5Rob Windsor
 
Instantmessagingprotocols
InstantmessagingprotocolsInstantmessagingprotocols
Instantmessagingprotocolssanjoysanyal
 
10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCFBarry Dorrans
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Jason Townsend, MBA
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Abdul Khan
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Jason Townsend, MBA
 
Introduction to web services and how to in php
Introduction to web services and how to in phpIntroduction to web services and how to in php
Introduction to web services and how to in phpAmit Kumar Singh
 
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...ecosio GmbH
 
Xml web services
Xml web servicesXml web services
Xml web servicesRaghu nath
 
Web services
Web servicesWeb services
Web servicesaspnet123
 

Was ist angesagt? (20)

WCF
WCFWCF
WCF
 
WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5
 
Web Services
Web ServicesWeb Services
Web Services
 
Instantmessagingprotocols
InstantmessagingprotocolsInstantmessagingprotocols
Instantmessagingprotocols
 
10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCF
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
 
Introduction to Web Services
Introduction to Web ServicesIntroduction to Web Services
Introduction to Web Services
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
Introduction to web services and how to in php
Introduction to web services and how to in phpIntroduction to web services and how to in php
Introduction to web services and how to in php
 
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
Introduction to Service Oriented Architectures, SOAP/WSDL Web Services and RE...
 
WSDL
WSDLWSDL
WSDL
 
Xml web services
Xml web servicesXml web services
Xml web services
 
WSDL 2.0 and Apache Woden
WSDL 2.0 and Apache WodenWSDL 2.0 and Apache Woden
WSDL 2.0 and Apache Woden
 
Web services
Web servicesWeb services
Web services
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
 

Ähnlich wie P2P .NET short seminar

Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its SecurityMindfire Solutions
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Jorgen Thelin
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
05 rpc-case studies
05 rpc-case studies05 rpc-case studies
05 rpc-case studieshushu
 
Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Sri Prasanna
 
Context And Concept Of Web Services
Context And Concept Of Web ServicesContext And Concept Of Web Services
Context And Concept Of Web ServicesFatih Taşkın
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
Networking Fundamentals
Networking Fundamentals Networking Fundamentals
Networking Fundamentals Vikas Gupta
 
lec3_10.ppt
lec3_10.pptlec3_10.ppt
lec3_10.pptImXaib
 
Computer networking (nnm)
Computer networking (nnm)Computer networking (nnm)
Computer networking (nnm)nnmaurya
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication FoundationDavid Truxall
 
SOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolSOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolMasud Rahman
 
NaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web ServicesNaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web ServicesVideoguy
 
NaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web ServicesNaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web ServicesVideoguy
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio
 
Remote access service
Remote access serviceRemote access service
Remote access serviceApoorw Pandey
 

Ähnlich wie P2P .NET short seminar (20)

Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
05 rpc-case studies
05 rpc-case studies05 rpc-case studies
05 rpc-case studies
 
Web services
Web servicesWeb services
Web services
 
Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)
 
Context And Concept Of Web Services
Context And Concept Of Web ServicesContext And Concept Of Web Services
Context And Concept Of Web Services
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
Networking Fundamentals
Networking Fundamentals Networking Fundamentals
Networking Fundamentals
 
lec3_10.ppt
lec3_10.pptlec3_10.ppt
lec3_10.ppt
 
Week 2
Week 2Week 2
Week 2
 
OSI layer by cisco
OSI layer by ciscoOSI layer by cisco
OSI layer by cisco
 
Computer networking (nnm)
Computer networking (nnm)Computer networking (nnm)
Computer networking (nnm)
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
SOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolSOAP--Simple Object Access Protocol
SOAP--Simple Object Access Protocol
 
NaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web ServicesNaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web Services
 
NaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web ServicesNaradaBrokering Grid Messaging and Applications as Web Services
NaradaBrokering Grid Messaging and Applications as Web Services
 
Dce rpc
Dce rpcDce rpc
Dce rpc
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
 
Remote access service
Remote access serviceRemote access service
Remote access service
 

Kürzlich hochgeladen

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 

Kürzlich hochgeladen (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

P2P .NET short seminar

  • 1. P2P and .NET: a walk-through Giuliana Carullo - Luca Pepe Daniele Valenza Distributed Systems Course University of Salerno 2012/2013
  • 2. OUTLINE  Overview of Microsoft Windows P2P Networking.  A P2P application development introduction with .Net and WCF.
  • 3. P2P definitions Cloud peerID (meshID) . . . peerID (meshID) Mesh address scope PNRP Dynamic DNS could be an alternative to PNRP… but is not the best solution given the transient nature of the mesh (NAT issues)
  • 4. P2P Application Flow There are three types of P2P application:  one-to-one  one-to-many  many-to-many When one peer in a mesh wants to communicate three steps must be performed:  Find peer (PNRP or People Near Me)  Send invitation  Join mesh
  • 5. PNRP Peer Name Resolution Protocol (PNRP) is a peer-to- peer protocol designed by Microsoft that enables dynamic name publication and resolution.  Two version are available:  PNRP version 1 was included in Windows XP SP2, Windows XP Professional x64 Edition, and Windows XP SP1 with the Advanced Networking Pack for Windows XP  PNRP version 2 was released with Windows Vista, and was made available to Windows XP SP2 users through a separate download. Windows 7 and Windows 8 also uses version 2. Version 1 and version 2 of PNRP are not compatible. We cover only version 2
  • 6. PNRP Key attributes:  Distributed and serverless: each peer caches a portion of the list of names on the mesh and further refers to other.  IDs are used: names are language-dependent.  Multiple IDs: Each service on the mesh has its own identifier, thus every node may have one or more IDs.  Scalable ID management: the growing list of IDs is managed using a multilevel cache and referral system based on DHT (Chord-Pastry-like)
  • 7. PNRP ID A peer name is an endpoint for communication, which can be a computer, a user, a group, a service, or anything else that you want to resolve to an IPv6 address (IPv4 compatible). Peer names can be registered as:  Secured: Protected with certificate and digital signature.  Unsecured: Recommended for use in private network only (names can easily be spoofed).
  • 8. PNRP ID structure Public Key Hash authority.classifier Friendly Name (≤ 150 char) (128 bits) Service Location (128 bits) Hash P2P ID PNRP ID
  • 9. Secured PNRP ID Cloud pn1 . . . pnN DHT PNRP ID Certified Peer Address IPv6 Address The Certified Peer Address (CPA) is a self-signed certificate that provides authentication protection for the PNRP ID and contains application endpoint information such as addresses, protocol numbers, and port numbers.
  • 10. PNRP Clouds grouping of computers that are able to find each other. PNRP provides two type of clouds:  Global cloud the global IPv6 address scope and global addresses and represents all the computers on the entire IPv6 Internet. There is only a single global cloud.  Link-local cloud A link-local cloud is for a specific link, which is typically the same as the locally attached subnet. There can be multiple link-local clouds.
  • 11. PNRP – Peer resolution (cache hit) pr local cache lookup pt IPv6 pt Req. Message Resp. Message 1 2
  • 12. lookup (closest(pt)=pi)) IPv6 PNRP – Peer resolution (cache miss) pr local cache pt pi Req. Message Resp. Message 1 2 3 Iterate step 2 until pt is found
  • 13. PNRP Cache Initialization Three methods are executed at start up:  Persistent cache entries: Reload from hard-disk cached entries stored before shutdown  PNRP seed nodes: PNRP allows administrators to specify the addresses or DNS names of PNRP seeds nodes  Simple Service Discovery Protocol: PNRP nodes are required to register themselves using the Universal Plug-and-Play (UPnP) Simple Service Discovery Protocol (SSDP).
  • 15. OUTLINE  OVERVIEW OF P2P APPLICATIONS USING WCF AND .NET  A DEVELOPER’S INTRODUCTION TO P2P APPLICATION DEVELOPMENT
  • 16. .Net Framework 4.5 Windows Presentation Foundation Windows Communication Foundation Base Class and Task Parallel Library Languages: C# 5.0 Visual Basic 11 Visual C++ 11 Windows 8 Support ASP. Net Windows Workflow Foundation ADO .NET Windows Extensibility Framework
  • 17. Windows Communication Foundation (WCF) is a framework for building Distributed and Service- Oriented Applications. WCF
  • 18. WCF: Main Features  Service Orientation  AJAX and REST Support  specific XML formats (ATOM or RSS)  non-XML formats (JSON)  Plain XML and SOAP  Interoperability  Backward Compatibility (COM - COM+, .Net Remoting, ASP.NET)  Other non-Windows technologies  Security (Encryption and Authentication)  Extensibility (e.g, custom bindings, custom transport of SOAP messages).
  • 19. P2P requirements Primary issues that must be taken into account:  End-to-end connectivity: ensure communication between peers, even in cases where different technologies are adopted.  Common foundation: identity management, contract management, node discovery, node naming, secure session management, multipeer communication, and so on.  Secure and Scalable deployment: the ability to build on protocols specifically engineered for large-scale deployment, and to provide built-in security.
  • 20. P2P requirements End-to-end connectivity: ensure communication between peers, even in cases where different technologies are adopted. Solved by WCF which ensures interoperability between nodes using messages that are platform independent (WS-* specifications)
  • 21. P2P requirements Secure and Scalable deployment: the ability to build on protocols specifically engineered for large-scale deployment, and to provide built-in security Several security levels are available:  None: No security is required.  Transport: No message security is implemented; only neighbor-to-neighbor security is required.  Message: Only message authentication is required when communicating over an open channel.  TransportWithMessageCredential: Message and transport security.
  • 22. P2P requirements  Common foundation: identity management, contract management, node discovery, node naming, secure session management, multipeer communication, and so on. More details in the following.
  • 23. WCF ABC Major point Address: specifies the location of the service and is used by the clients for communication Binding: Specifies how a service is accessible Contract: Used to specify what the service can do
  • 24. Endpoint Endpoint provides clients access to the functionality offered by a WCF service and all communication occurs through it. Endpoint representation: (Address, binding, contract, Behaviors) the endpoint may be specified imperatively using code (System.net namespace) or declaratively through configuration.
  • 25. Endpoint component Address: The address specifies the location of the service and is used by the clients for communication The address's protocol that WCF can provided: HTTP, TCP, NamedPipe, Peer2Peer, MSMQ The Address is represented in the WCF object model by the EndpointAddress class that contains the following property:  Uri: which represents the address of the service  Identity: security identity of the service  Headers: additional and more detailed addressing information to identify or interact with the endpoint
  • 26. Endpoint component Bindings: The binding specifies how to communicate with the endpoint. A binding is represented in the WCF object model by the abstract base class Binding. Extending the Binding class we can specify:  transport protocol (e.g, TCP or HTTP).  message encoding (e.g, text or binary).  security requirements (e.g, SSL, SOAP security)
  • 27. Endpoint component Contract Is the interface representing the functionalities exposed by the service. Annotations are added to the Interface in order to define a contract:  [ServiceContract()] is declared on the top of the interface and defines the contract  [OperationContract] is added to each method of the interface and defines the relative functionality. Three attributes may be exclusively defined: one-way, request-reply, duplex.
  • 28. Endpoint component Behaviors: customization of the service endpoint. Endpoint behaviors achieve this by participating in the process of building a WCF runtime. An example of an endpoint behavior is the ListenUri property,which allows to specify a different listening address than the SOAP or (WSDL) address.
  • 29. Endpoint in configuration Endpoint property can be defined in an XML file (app.config) in which following sections are defined:  Bindings (<bindings>): specifies an aspect of how an endpoint communicates with the world: transports (e.g., HTTP, TCP) and features(Security, Reliability, Transaction flows)  Endpoint (<endpoint>): Endpoints provide clients access to the functionality offered by a WCF service (address, bindings, contract, behavior)  Services (<services>): specifications for all services the application hosts, defining endpoints  Client (<client>): specifies endpoints used by the application to connect to a service
  • 30. WCF P2P configuration P2P inherits all building blocks defined for WCF services. In particular a special binding is provided for this kind of application:  NetPeerTcpBinding provides support for the creation of peer networking applications that use a TCP-level peer- to-peer mesh infrastructure Since nodes are peer, they must behave like service and like client. Thus, configurations for both <services> and <client> must be specified in the same app and they must use the NetPeerTcpBinding binding type.
  • 32. Peer Node and Peer Resolver peer node: instance of an application that participates in the mesh. peer resolver: responsible for resolving a mesh ID to the endpoint addresses of a few nodes in the mesh. (PNRP or custom )
  • 33. Mesh ID Mesh IDs identify the host portion of the address of an endpoint in the mesh. Examples of these addresses are "net.p2p://chatMesh/servicemodelsamples/chat" "net.p2p://broadcastMesh/servicemodelsamples/announce". chatMesh and broadcastMesh are the mesh IDs. All clients that participate in a mesh use the same mesh ID, but can potentially use different paths and services. A message addressed to a specific endpoint address is delivered to all peer channels using that address.
  • 34. Mesh network Two types of Mesh are defined:  Groupings: used by the Data Replication service. The various peers in the mesh exchange messages by replicating records containing the data. Implementation is unmanaged (Win32 API library)  Peer channels: a message-based service, available in WCF (managed code)
  • 35. Mesh creation 1. A peer node open a peer channel (the status of the peer become opened) 2. Peer Node use a peer resolver (PNRP or custom)to resolve mesh ID to the addresses of other peer nodes to connect to. 3. Peer Node estrablish connection with theother peers using peer channel Now, the mesh is created and the messages can be propagated.
  • 36. Peer Channel  automatically manages join and leave and can have any number of participants.  does not ensure message ordering e message reception (Best effort).  Prevent replicated message reception  A connection to a neighbor might be terminated if it keeps trying to resend a message that has been processed previously.
  • 37. Peer Channel: Application Flow pr pt Network Request Connection Accept / Decline Connection accepted: welcome message is sent which contain also the list of other nodes that are part of the mesh.
  • 38. Peer Channel: Application Flow pr pt Network Request Connection Accept / Decline Connection refused: pt sends to pr a refusal message, containing the reason for the refusal and a list of the addresses of the other nodes in the mesh.
  • 40. References 1. MSDN An introduction to WCF. http://msdn.microsoft.com/en-us/library/ms731082.aspx 2. Bill Evjen, Christian Nagel, Rod Stephens Professional ASP.NET 4, Professional C#, chapter 45 available at http://blogs.wrox.com/files/2013/05/502259_c45_p2_ed.pd f 3. Nishith Pathak, Pro WCF 4: Practical Microsoft SOA Implementation, Apress, Berkley, CA, 2011 4. MSDN Binding types, http://msdn.microsoft.com/en- us/library/ms733099.aspx 5. MSDN Defining Bindings by configuration file. http://msdn.microsoft.com/en-us/library/ms734786.aspx
  • 41. References 6. MSDN Defining Bindings by code. http://msdn.microsoft.com/en-us/library/ms731080.aspx 7. MSDN P2P Programming with WCF, and .Net 3.5 http://msdn.microsoft.com/en-us/library/cc297274.aspx 8. MSDN Introduction to WCF 4. http://msdn.microsoft.com/en-us/library/ee354381.aspx 9. MSDN Peer2Peer Networking. http://msdn.microsoft.com/en-us/library/ms733761.aspx 10. MSDN Net Peer TCP. http://msdn.microsoft.com/en- us/library/ms751426%28v=vs.85%29.aspx 11. MSDN Peer Channel Concept. http://msdn.microsoft.com/en-us/library/ms731061.aspx