Peer Channel - Getting Started

 

PeerChannel is part of the Windows Communication Foundation(WCF, formerly Indigo) framework that enables development of managed Peer-to-Peer applications. We shipped as part of the Winfx SDK Beta1 and are now also part of the Pre-Beta2 September CTP release.

 

  • P2P unmanaged API's- are we related?

Yup. We are part of the same Windows team that gave us the P2P SDK (now part of Platform SDK)- Grouping, Graphing, Peer Name Resolution Protocol (PNRP) Name Space - the works.

 

  • Ok, so where do I begin?
      1. Since we closely follow the Indigo programming model, getting a little familiar with Indigo(WCF) would be a good idea. A great place to start: https://msdn.microsoft.com/webservices/indigo/default.aspx
      2. The September PDC slides related to PeerChannel and P2P in general maybe found at https://commnet.microsoftpdc.com/content/downloads.aspx under COM311 Developing P2P Applications Using Windows Vista and the Windows Communication Foundation (“Indigo”) PeerChannel
      3. Install the latest Winfx SDK and runtime components from the following links:
        1. WinFX SDK:    https://www.microsoft.com/downloads/details.aspx?FamilyId=C20CC6C8-1F4E-4A5C-BC79-C2FE9ABE69AA&displaylang=en
        2. WinFX Runtime Components:    https://www.microsoft.com/downloads/details.aspx?FamilyId=FFD636F0-86E9-41E8-9E1C-100A4CC4888F&displaylang=en
        3. VS Extensions for WinFX RC:   https://www.microsoft.com/downloads/details.aspx?FamilyId=EDE1A645-2A53-42E1-8482-3BF1FADADE06&displaylang=en
        4. WinFX RC Sept CTP “Readme”: https://msdn.microsoft.com/windowsvista/default.aspx?pull=/library/en-us/dnlong/html/WinFXSeptPDCReadme.asp 

                   4. Install Issues that I faced: I followed the steps above and experienced only one known setup problem with the RunTime Components that is also documented in the Setup Readme (4 above). I list it here for easy reference:

                     

WinFX Redist Setup does not resume after reboot               

 

An application is running that is using the .NET Framework v1.1, for example threadsleep.exe. After starting to install winfxrc.exe, you are presented with a reboot dialog and select "reboot now". After rebooting the following dialog box appears:

WinFX Runtime Components Core Redistributable Beta 2 Setup

The Windows Installer package:

c:\452ad5b9fcf1a01e1769fdcf801a\vs_setup.msi

could not be opened.

Choose Retry to try again. Choose Cancel to exit setup.

[Retry/Cancel]

Retry will not work because, after reboot, the temp folder is gone.

You click Cancel and start a new install of winfxrc.exe.

To resolve this issue:

Install .NET Framework from one of the following locations before running WinFX Setup.

X86 .NET Framework: https://go.microsoft.com/fwlink/?linkid=51020

X64 .NET Framework: https://go.microsoft.com/fwlink/?linkid=51021

—or—

Manually rerun seutp after the reboot.

Pasted from <https://msdn.microsoft.com/windowsvista/default.aspx?pull=/library/en-us/dnlong/html/WinFXSeptPDCReadme.asp>

Other issues that you may encounter are documented in the readme file above (Step 3 above)

 

            5. PeerChannel Samples: Found at C:\Program Files\Microsoft SDKs\WinFX\samples\Allsamples\WindowsCommunicationFou
ndation\TechnologySamples\Basic\Binding\NetProfile\PeerTcp\CS,this Broadcast sample demonstrates how to implement a M:N broadcast application using a Peer Channel.

 

[Note] There are other samples (CustomResolver and Chat) available for download from the Beta1 release of the Winfx SDK. But these may NOT compile due to changes from the Beta1 model(naming changes, API changes etc). I'll talk about this in my next entry.

 

                      6. Sample Troubleshooting: (This was the only issue I saw with our samples in this release of the Winfx PreBeta2 SDK).  

                        

                         System.InvalidOperationException: Resolver must be specified. The default resolver (PNRP) is not available.

               Resolution:

The sample assumes you are running PNRP. Since PNRP service is not enabled by default on Pre-Longhorn(Vista) platforms you need to follow the steps below to make sure PNRP* is up and running:

 

1. Go to Start=>Run. Type Appwiz.cpl. This opens the ControlPanel - Add Remove Software dialogue box. Choose Add Remove Windows Components and then choose Networking => Details. Make sure Peer-to-Peer is checked. Click Install.

2. Then, open up a cmd prompt and type "net start pnrpsvc". This should start up the installed pnrp service for us.  

3. Run the sample now. This should solve the problem.

*PNRP is only available on the following Windows SKUs:
- Windows XP (SP1 + Networking pack installed)
- Windows XP SP2
- Windows Vista pre-release
- Windows 64-bit XP-Pro Client

PNRP is not available on any Windows Server SKUs, including Windows Server 2003 SP1.

 

 

-Shalini.