15.02.2015 Views

C# 4 and .NET 4

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1346 ❘ ChaPTer 45 peer-tO-peer netwOrkinG<br />

alternative key scheme, but the keys must be 256-bit integer values (just like PNRP IDs). This means that you<br />

can use any scheme you want, but you are then responsible for the generation <strong>and</strong> security of the keys. By<br />

using this component you can create new cloud topologies beyond the scope of PNRP, <strong>and</strong> indeed, beyond the<br />

scope of this chapter as this is an advanced technique.<br />

Windows 7 also introduces a new way of connecting to other users for the Remote Assistance application:<br />

Easy Connect. This connection option uses PNRP to locate users to connect to. Once a session is created,<br />

through Easy Connect or by other means (for example an e-mail invitation), users can share their desktops<br />

<strong>and</strong> assist each other through the Remote Assistance interface.<br />

People near me<br />

PNRP, as you saw in the previous section, is used to<br />

locate peers. This is obviously important as an enabling<br />

technology when you consider the discovery/connection/<br />

communication process of a P2P application, but in itself<br />

is not a complete implementation of any of these stages.<br />

The People Near Me service is an implementation of the<br />

discovery stage, <strong>and</strong> enables you to locate peers that are<br />

signed in to the Windows People Near Me service in your<br />

local area (that is, in a link local cloud that you are<br />

connected to).<br />

You may have come across this service because it is built into<br />

Vista <strong>and</strong> Windows 7, <strong>and</strong> is used in the Windows Meeting<br />

Space application, which you can use for sharing applications<br />

among peers. You can configure this service through the<br />

Change People Near Me settings control panel item (you can<br />

navigate to this quickly by typing “people” in the Start menu<br />

search box). This control panel item displays the dialog box<br />

shown in Figure 45-6.<br />

After you have signed in, the service is available to any application<br />

that is built to use the PNM service.<br />

At the time of writing, PNM is available only on the Windows Vista family of operating systems (<strong>and</strong> it has<br />

been removed from Windows 7). However, it is possible that future service packs or additional downloads<br />

may make it available on Windows XP.<br />

building P2P aPPliCaTions<br />

Now that you have learned what P2P networking is <strong>and</strong> what technologies are available to .<strong>NET</strong> developers<br />

to implement P2P applications, it’s time to look at how you can build them. From the preceding discussion<br />

you know that you will be using PNRP to publish, distribute, <strong>and</strong> resolve peer names, so the first thing you<br />

look at here is how to achieve that using .<strong>NET</strong>. Next you look at how to use PNM as a framework for a P2P<br />

application. This can be advantageous because if you use PNM you do not have to implement your own discovery<br />

mechanisms.<br />

To examine these subjects you need to learn about the classes in the following namespaces:<br />

➤<br />

➤<br />

System.Net.PeerToPeer<br />

System.Net.PeerToPeer.Collaboration<br />

figure 45-6<br />

To use these classes you must have a reference to the System.Net.dll assembly.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!