Upload
darren-french
View
220
Download
0
Embed Size (px)
Citation preview
“Indigo”: Building Peer-To-Peer Applications
Todd R. ManionProgram ManagerMicrosoft [email protected]
Session Code: WSV306
AgendaAgenda
Overall ArchitecturePeer-to-Peer LandscapeWhy Something New?Design GuidelinesPeer-to-Peer TechnologiesCode WalkthroughsCall to Action
Overall ArchitecturePeer-to-Peer LandscapeWhy Something New?Design GuidelinesPeer-to-Peer TechnologiesCode WalkthroughsCall to Action
Tools
Client Application Model
Avalon Windows Forms
Web & Service Application Model
ASP.NET / Indigo Win FSCompact
FrameworkYukon Mobile PC Optimized
System.HelpSystem.Help
System.DrawingSystem.Drawing
System.NaturalLanguageServicesSystem.NaturalLanguageServices
Data Systems Application Model
Presentation Data
Mobile PC & Devices Application Model
Communication
Command Line
NT Service
DataSetDataSet
MappingMapping
ObjectSpacesObjectSpaces
ObjectSpaceObjectSpace
QueryQuery
SchemaSchema
ItemItem
RelationshipRelationship
MediaMedia
AudioAudio
VideoVideo
ImagesImages
System.MessagingSystem.Messaging System.DiscoverySystem.Discovery
System.DirectoryServicesSystem.DirectoryServices
System.RemotingSystem.Remoting
System.Runtime.RemotingSystem.Runtime.Remoting
ActiveDirectoryActiveDirectory
UddiUddi
System.Web.ServicesSystem.Web.Services
Web.ServiceWeb.Service
DescriptionDescription
DiscoveryDiscovery
ProtocolsProtocols
System.MessageBusSystem.MessageBus
TransportTransport
PortPort
ChannelChannel
ServiceService
QueueQueue
PubSubPubSub
RouterRouter
System.TimersSystem.Timers
System.GlobalizationSystem.Globalization
System.SerializationSystem.Serialization
System.ThreadingSystem.Threading
System.TextSystem.Text
System.DesignSystem.Design
Base & Application Services
Fundamentals
System.ComponentModelSystem.ComponentModel
System.CodeDomSystem.CodeDom
System.ReflectionSystem.Reflection
System.EnterpriseServicesSystem.EnterpriseServices
System.TransactionsSystem.Transactions
Security
System.Windows.TrustManagementSystem.Windows.TrustManagement
System.Web.SecuritySystem.Web.Security
System.MessageBus.SecuritySystem.MessageBus.Security
AuthorizationAuthorization
AccessControlAccessControl
CredentialsCredentials
CryptographyCryptography
System.Web.ConfigurationSystem.Web.Configuration
System.MessageBus.ConfigurationSystem.MessageBus.Configuration
System.ConfigurationSystem.Configuration
System.ResourcesSystem.ResourcesSystem.ManagementSystem.Management
System.DeploymentSystem.Deployment
System.DiagnosticsSystem.Diagnostics
Configuration Deployment/Management
System.WindowsSystem.Windows System.WindowsSystem.WindowsSystem.Windows.FormsSystem.Windows.Forms
System.ConsoleSystem.Console
System.ServiceProcessSystem.ServiceProcess
System.Windows.FormsSystem.Windows.Forms System.WebSystem.Web System.StorageSystem.Storage System.Data.SqlServ
erSystem.Data.SqlServer
AnimationAnimation
ControlsControls
ControlControl
DesignDesign
PanelPanel
ControlsControls
DialogsDialogs
SideBarSideBar
NotificationNotification
System.WindowsSystem.Windows
DocumentsDocuments
Text ElementText Element
ShapesShapes
ShapeShape
InkInk
UI ElementUI Element ExplorerExplorer MediaMedia
System.Windows.FormsSystem.Windows.Forms
FormsForms
ControlControl
Print DialogPrint Dialog
DesignDesign
System.Web.UISystem.Web.UI
PagePage
ControlControl
HtmlControlsHtmlControls
MobileControlsMobileControls
WebControlsWebControls
AdaptorsAdaptors
DesignDesign
PortsPorts
InteropServicesInteropServices
System.RuntimeSystem.Runtime
System.IOSystem.IO
System.CollectionsSystem.Collections
GenericGeneric
System.SearchSystem.Search
AnnotationsAnnotations
MonitoringMonitoring
LoggingLogging
RelevanceRelevance
System.DataSystem.Data
SqlClientSqlClient
SqlTypesSqlTypes
SqlXMLSqlXML
OdbcClientOdbcClient
OleDbClientOleDbClient
OracleClientOracleClient
CoreCore
ContactContact
LocationLocation
MessageMessage
DocumentDocument
EventEvent
System.StorageSystem.Storage
System.WebSystem.Web
PersonalizationPersonalization
CachingCaching
SessionStateSessionState
System.XmlSystem.Xml
SchemaSchema
SerializationSerialization
XpathXpath
QueryQuery
PermissionsPermissions
PolicyPolicy
PrincipalPrincipal
TokenToken
System.SecuritySystem.Security
System.CollaborationSystem.Collaboration
RealTimeEndpointRealTimeEndpoint
TransientDataSessionTransientDataSession
SignalingSessionSignalingSession
MediaMedia
ActivitiesActivities
HttpWebRequestHttpWebRequest
FtpWebListenerFtpWebListener
SslClientStreamSslClientStream
WebClientWebClient
System.NetSystem.Net
NetworkInformationNetworkInformation
PeerIdentityPeerIdentity
PnrpPnrp
System.WebSystem.Web
AdministrationAdministration
ManagementManagement
NavigationNavigation
Peer StorePeer Store
PolicyPolicy
SerializationSerialization
CompilerServicesCompilerServices
RecognitionRecognition
System.SpeechSystem.Speech
SynthesisSynthesis
Base Operating System Services CLR
Transactions Storage
Protocols
Network Services
Kern
el M
ode
Base Class LibrariesBase Class Libraries
Memory ManagerMemory Manager
Hosting LayerHosting Layer
Code ExecutionCode Execution LoaderLoader SecuritySecurity SerializationSerialization
LightweightTransactionsLightweightTransactions
TransactionCoordinatorTransactionCoordinator
KernelTransactionManager
KernelTransactionManager
CommonLoggingFile System
CommonLoggingFile System
TransactedFile SystemTransactedFile System
KernelKernel
Hardware Abstraction LayerHardware Abstraction Layer
ProcessManagerProcessManager
SecurityReference Monitor
SecurityReference Monitor
LPCFacilityLPCFacility
MemoryManagerMemoryManager
PowerManagerPowerManager
Config.ManagerConfig.Manager
Plug andPlayPlug andPlay File System CacheFile System Cache
NTFSNTFS FAT 16/32FAT 16/32FilterEngineFilterEngine
TPC, UDPIPV4, IPV6TPC, UDPIPV4, IPV6 IPSECIPSEC QOSQOS HTTP
ListenerHTTPListener
Internet Connection FirewallInternet Connection Firewall
Demand Activation and Protocol HealthDemand Activation and Protocol Health
PNRPPNRP NativeWiFiNativeWiFi SIPSIP TCP ListenerTCP ListenerUDP ListenerUDP ListenerIPC ListenerIPC Listener
Network Class LibraryNetwork Class Library
GDI/GDI+GDI/GDI+ WindowManagerWindowManager
GlobalAudio Engine
GlobalAudio Engine
DirectXGraphicsDirectXGraphics
Graphics driversGraphics drivers
DDIDDI InputManagerInputManager
AudioDriversAudioDrivers
DirectX GraphicsMini port
DirectX GraphicsMini port
RedirectorsRedirectors
.... 802.3802.3 802.11802.11 ....
Device and File System Drivers
ManagementManagement
Presentation Data Communication
WinFS Indigo
Make the connection
Windows FormsAvalon ASP.NET
ObjectSpacesObjectSpaces
DataSetDataSet
SQL XMLSQL XML
ProvidersProviders
Fram
ew
ork
Models
Services Schemas
Data Model
ADO.NET
Connectivity
Synchronization(WinFS, Win32..)Synchronization(WinFS, Win32..)
InfoAgent(PreferenceRules..)InfoAgent(PreferenceRules..)
FileSystem Services(MetaDataHandlers..)FileSystem Services(MetaDataHandlers..)
ExchangeExchange MediaMedia
DocumentDocument ……
ItemsItems
RelationshipsRelationships
ExtensionsExtensionsCommunications Manager (Port)Communications Manager (Port)
ServiceServiceObjectObject T/SQLT/SQL XMLXML
Services
Transport Channels(IPC, HTTP, TCP…)Transport Channels(IPC, HTTP, TCP…)
Channels (Datagram, Reliable, Peer, …)
Channels (Datagram, Reliable, Peer, …)
Policy EnginePolicy Engine
MessageEncoderMessageEncoder
ChannelSecurityChannelSecurity
QueueQueue
TopicTopic
RouterRouter
TransactionTransaction
DocumentDocument UIUI MediaMedia
Desktop ServicesDesktop ServicesDesktop WindowManagerDesktop WindowManager
Presentation Object ManagerPresentation Object Manager
Desktop CompositionEngineDesktop CompositionEngine
Animation andCompositionAnimation andComposition
Media Services
Hardware RenderingHardware Rendering
MediaProcessingMediaProcessing
Capture and SourcingCapture and Sourcing
Software Renderingand SinksSoftware Renderingand Sinks
Adaptive UIEngineAdaptive UIEngine
Page/SiteCompositionPage/SiteComposition
Personalization andProfiling ServicesPersonalization andProfiling Services
Membership and Security ServicesMembership and Security Services
Designer ServicesDesigner Services
Controls Interop EngineControls Interop Engine
ControlsControls
Windows Forms
ApplicationServicesApplicationServices
Application DeploymentEngine (Click-Once)
Application DeploymentEngine (Click-Once)
IO ManagerIO Manager
PeoplePeople GroupGroup
Identity &SecuritySystem
Identity &SecuritySystem
Collaboration
PeoplePeople
GroupGroup
Controls(Chat, …)Controls(Chat, …)
SignalingSignalingFederationFederation
Servers
Network Class LibraryNetwork Class Library
Internet Connection FirewallInternet Connection Firewall
Demand Activation and Process Health - IISDemand Activation and Process Health - IIS
PNRPPNRP Native WiFiNative WiFi TCP
ListenerTCP Listener
SIPSIP UDPListenerUDPListener
IPCListenerIPCListener
Network Services
CLR
SerializationSerialization
Kern
el M
od
eF
rame
wo
rk
Protocols
Filter EngineFilter Engine
TCP, UDPIPV4, IPV6TCP, UDPIPV4, IPV6 QOSQOSIPSECIPSEC HTTP
ListenerHTTPListener
IOManager
Device and File System Drivers
…… 802.3802.3 ……802.11802.11
Connector
Communications Manager (Port)Communications Manager (Port)
Transport Channels(IPC, HTTP, TCP…)Transport Channels(IPC, HTTP, TCP…)
Channels (Datagram, Reliable, Peer, …)Channels (Datagram, Reliable, Peer, …)
Policy EnginePolicy Engine
Message EncoderMessage Encoder
Channel SecurityChannel Security
Hosting Environments
ASP.NETASP.NET .container.container .exe.exe NT ServiceNT Service DllHostDllHost
RouterRouter
TopicTopic
……
Transactions Transactions
FederationFederation
……
Service Model
Instance ManagerInstance Manager
Context ManagerContext Manager
TypeIntegrationTypeIntegration
ServiceMethodsServiceMethods PeerStorePeerStore ……
QueueQueue
Indigo
Identity andSecuritySystem
Identity andSecuritySystem
TransactionsTransactions
MessagingServices
SystemServices
Peer-To-Peer LandscapePeer-To-Peer Landscape
CollaborationProject workspaces solving a goalSharing your files with other people
Content DistributionConcert, company meeting, classDistribution of product updates
Real-Time CommunicationsInstant messaging, voice, videoReal-time game play/collaboration
Distributed ProcessingDissection and distribution of task
Improved Internet Technologies
CollaborationProject workspaces solving a goalSharing your files with other people
Content DistributionConcert, company meeting, classDistribution of product updates
Real-Time CommunicationsInstant messaging, voice, videoReal-time game play/collaboration
Distributed ProcessingDissection and distribution of task
Improved Internet Technologies
Why Something New?Why Something New?
Limited Supply of Public AddressesNATs Prevent Sharing from the EdgeLimited Name Resolution System
Does not handle dynamic addressesDoes not work in ad-hoc environmentsDoes not lend itself to consumer use
Inefficient Multipoint CommunicationEveryone Rewrites the Infrastructure
Limited Supply of Public AddressesNATs Prevent Sharing from the EdgeLimited Name Resolution System
Does not handle dynamic addressesDoes not work in ad-hoc environmentsDoes not lend itself to consumer use
Inefficient Multipoint CommunicationEveryone Rewrites the Infrastructure
Infrastructure Design GoalsInfrastructure Design Goals
Secure, robust in face of failure/attackScalable, from ad-hoc to the InternetServerless, no central point of failureSelf-tuning, adapts to constant changeSelf-repairing, automatically fixes itself
Secure, robust in face of failure/attackScalable, from ad-hoc to the InternetServerless, no central point of failureSelf-tuning, adapts to constant changeSelf-repairing, automatically fixes itself
Peer-To-Peer TechnologiesPeer-To-Peer Technologies
Peer Name Resolution Protocol (PNRP)Scalable, secure, serverless name resolution
"Indigo" PeerChannelEfficient distribution of information between nodesAuto-tuning, self-repairing communication layer
Peer GroupsCreate and manage persistent securable groups
Peer Store*Distributed data managementSynchronized, replicated meta-data store
* Built using WinFS in Longhorn
Peer Name Resolution Protocol (PNRP)Scalable, secure, serverless name resolution
"Indigo" PeerChannelEfficient distribution of information between nodesAuto-tuning, self-repairing communication layer
Peer GroupsCreate and manage persistent securable groups
Peer Store*Distributed data managementSynchronized, replicated meta-data store
* Built using WinFS in Longhorn
Code WalkthroughsCode Walkthroughs
Name Resolution (PNRP)"Indigo" PeerChannelPeer Group and Peer Store
Name Resolution (PNRP)"Indigo" PeerChannelPeer Group and Peer Store
Code WalkthroughsCode Walkthroughs
Name Resolution (PNRP)Create, Register, and Resolve a PnrpEndPoint
"Indigo" PeerChannelPeer Group and Peer Store
Name Resolution (PNRP)Create, Register, and Resolve a PnrpEndPoint
"Indigo" PeerChannelPeer Group and Peer Store
Register/Resolve In PNRP
Name Registration/ResolutionName Registration/Resolution
Members of System.Net.PeerToPeerMajor Objects
PeerName PeerIdentityPnrpEndPointPnrpEndPointRegistrationPnrpEndPointResolverCloud/CloudWatcher
Available in Longhorn PDC Preview
Members of System.Net.PeerToPeerMajor Objects
PeerName PeerIdentityPnrpEndPointPnrpEndPointRegistrationPnrpEndPointResolverCloud/CloudWatcher
Available in Longhorn PDC Preview
PnrpEndPointRegistrationPnrpEndPointRegistration
PnrpEndPointRegistration reg = new PnrpEndPointRegistration();…private void RegisterInPnrp(IPEndPoint[] myEndPoints){ PeerName peerName = new PeerName(“0.ToddAtThePDC”); PnrpEndPoint endPoint = new PnrpEndPoint(peerName, myEndPoints);
reg.PnrpEndPoint = endPoint; reg.Cloud = CloudWatcher.GetGlobalCloud();
reg.Register();}
PnrpEndPointResolverPnrpEndPointResolver
PnrpEndPointResolver resolver = new PnrpEndPointResolver();…private void ResolveInPnrp(){ // Retrieve the settings and fill out the resolver properties. resolver.PeerName = new PeerName(“0.ToddAtThePDC”); resolver.Cloud = CloudWatcher.GetGlobalCloud(); resolver.MaxResults = 1; resolver.TimeOut = new TimeSpan(0, 0, 30); List<PnrpEndPoint> results = resolver.Resolve();
//Show the address of the resolved PeerName. if (results.Count > 0) MessageBox.Show(results[0].IPEndPoints[0].ToString());}
Code WalkthroughsCode Walkthroughs
Name Resolution (PNRP)“Indigo” PeerChannel
Create a PeerManager and channelAccept a new PeerChannelSend/Receive transient data via PeerChannel
PeerGroup and PeerStore
Name Resolution (PNRP)“Indigo” PeerChannel
Create a PeerManager and channelAccept a new PeerChannelSend/Receive transient data via PeerChannel
PeerGroup and PeerStore
“Indigo” PeerChannel Chat
“Indigo” PeerChannel“Indigo” PeerChannel
Major Objects PeerChannelPeerManagerNodeMessage Port
Available in future Longhorn release
Major Objects PeerChannelPeerManagerNodeMessage Port
Available in future Longhorn release
Create A PeerChannelCreate A PeerChannel
PeerManager peerMgr = new PeerManager();PeerChannel myChannel;…private void InitPeerManager(){ peerMgr.PeerRequested = new PeerRequestedEventHandler(this.MyPeerRequestedHandler);}
//Uri = “tcp.p2p://demo.microsoft.com:10000/demoLocalChannelId”private void CreatePeerChannel(Uri peerUri){ myChannel = peerMgr.CreateChannel(peerUri); }
private void MyPeerRequestedHandler(object sender, PeerRequestedEventArgs e)
{ … }
Accepting A PeerChannelAccepting A PeerChannel
PeerManager incomingMgr = new PeerManager();PeerChannel incomingPeer;…private void MyPeerRequestedHandler(object sender,
PeerRequestedEventArgs e){ incomingPeer = incomingMgr.AcceptPeer(e.Message); }
private void DisplayChannelNodes(){ listNodes.Items.Clear();
foreach(Node n in incomingPeer.Nodes) { ListViewItem lvi = new ListViewItem(n.FriendlyName); lvi.Tag = n.Id; listNodes.Items.Add(lvi); }}
Send A MessageSend A Message
// Uri = “tcp.p2p://demo.microsoft.com:10000/demoRemoteChannelId”private void SendChatMessage(Uri destination, string text){ Message msg = new Message(destination); msg.Body = text; myChannel.Send(msg);}
Receive A MessageReceive A Message
private void ReceiveChatMessage(){ Message msg = incomingPeer.Receive(); textBoxMessages.AppendText((string) msg.Data + “\r\n”);}
Code WalkthroughsCode Walkthroughs
Name Resolution (PNRP)“Indigo” PeerChannelPeer Group and Peer Store
Open, connect, enumerate membersAdd/Retrieve data to/from peer store
Name Resolution (PNRP)“Indigo” PeerChannelPeer Group and Peer Store
Open, connect, enumerate membersAdd/Retrieve data to/from peer store
Group Photo Album
PeerStore And PeerGroupPeerStore And PeerGroup
Major Objects PeerIdentityPeerGroupMemberPeerStoreRecord PeerGroupInfo
PeerStore built with WinFS in Longhorn
Major Objects PeerIdentityPeerGroupMemberPeerStoreRecord PeerGroupInfo
PeerStore built with WinFS in Longhorn
Open, Connect, Enumerate MembersOpen, Connect, Enumerate MembersPeerIdentity myIdentity;PeerGroup myGroup;...private void ConnectToFirstGroup(){ List<PeerIdentity> identities = PeerIdentity.GetIdentities(); myIdentity = identities[0]; List<PeerGroupInfo> myGroups = PeerGroup.GetGroups(myIdentity); myGroup = PeerGroup(myGroups[0]);
myGroup.Connect();}
private void DisplayMembers(){ List<Member> members = myGroup.GetMembers(); foreach(Member m in members) {
listMembers.Items.Add(m); }}
Add Data To GroupAdd Data To Group
private void AddPictureRecord(string fileName){ PeerRecord record = new PeerRecord(pictureGuid,DateTime.Now.AddDays(1));
record.Data = GetImageDataFromFile(fileName);
record.MetadataCollection.Add( new PeerRecordMetadata("FriendlyName",fileName));
myGroup.PeerStore.AddRecord(record);}
Retrieve Data From GroupRetrieve Data From Group
public void GetPictureList(){ listRecords.Items.Clear();
foreach (PeerRecord record in myGroup.Store.GetRecords(pictureGuid))
{ string strId = record.Id.ToString();
ListViewItem lvi = new ListViewItem(strId); lvi.Tag = record.Id; lvi.SubItems.Add(
record.MetadataCollection["FriendlyName"].ToString()); listRecords.Items.Add(lvi); }}
Corel Grafigo 2
Daniel JetteSoftware Design EngineerCorel Corporation
SummarySummary
Technology OfferingsScalable, secure, serverless name resolutionEfficient, self-repairing “Indigo” PeerChannelSecurable, persistent PeerGroup serviceDistributed data management via PeerStore
Developers free to focus on applicationIntegrated, consistent managed API
“Indigo” in PDC PreviewPNRP, PeerIdentity in PDC Preview
Technology OfferingsScalable, secure, serverless name resolutionEfficient, self-repairing “Indigo” PeerChannelSecurable, persistent PeerGroup serviceDistributed data management via PeerStore
Developers free to focus on applicationIntegrated, consistent managed API
“Indigo” in PDC PreviewPNRP, PeerIdentity in PDC Preview
Call To ActionCall To Action
Think Connectivity and Collaboration!Don’t Wait!
Utilize Peer-to-Peer v1.0 todayV1.0 runtime and Win32 APIs are available via Windows Update
Utilize “Indigo” bits in PDC Preview
Get More Informationhttp://www.microsoft.com/[email protected] on PDC bits DVD
Think Connectivity and Collaboration!Don’t Wait!
Utilize Peer-to-Peer v1.0 todayV1.0 runtime and Win32 APIs are available via Windows Update
Utilize “Indigo” bits in PDC Preview
Get More Informationhttp://www.microsoft.com/[email protected] on PDC bits DVD
For More InformationFor More Information
Come see meImmediately after this sessionWeb Services Booth/Lounge: 309 Foyer
MSDN “Longhorn” DevCenter http://msdn.microsoft.com/longhornNewsgroups
microsoft.public.windows.developer.winfx.indigomicrosoft.public.win32.programmer.networks
At PDCHands on labs: On-site or download on CommNetPDC Weblogs: http://pdcbloggers.net
Come see meImmediately after this sessionWeb Services Booth/Lounge: 309 Foyer
MSDN “Longhorn” DevCenter http://msdn.microsoft.com/longhornNewsgroups
microsoft.public.windows.developer.winfx.indigomicrosoft.public.win32.programmer.networks
At PDCHands on labs: On-site or download on CommNetPDC Weblogs: http://pdcbloggers.net