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.

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

PnrP iDs<br />

PNRP IDs are 256-bit identifiers. The low-order 128 bits are used to uniquely identify a particular peer,<br />

<strong>and</strong> the high-order 128 bits identify a peer name. The high-order 128 bits are a hashed combination<br />

of a hashed public key from the publishing peer <strong>and</strong> a string of up to 149 characters that identifies the<br />

peer name. The hashed public key (known as the authority) combined with this string (the classifier)<br />

are together referred to as the P2P ID. It is also possible to use a value of 0 instead of a hashed public<br />

key, in which case the peer name is said to be unsecured (as opposed to secured peer names, which use a<br />

public key).<br />

The structure of a PNRP ID is illustrated in Figure 45-4.<br />

PNRP ID<br />

128-bit hashed P2P ID<br />

128-bit service location<br />

P2P ID<br />

Authority (hashed public key)<br />

Classifier (peer name identifier)<br />

figure 45-4<br />

The PNRP service on a peer is responsible for maintaining a list of PNRP IDs, including the ones<br />

that it publishes as well as a cached list of those it has obtained by PNRP service instances elsewhere<br />

in the cloud. When a peer attempts to resolve a PNRP ID, the PNRP service either uses a cached<br />

copy of the endpoint to resolve the peer that published the PNRP or it asks its neighbors if they can<br />

resolve it. Eventually a connection to the publishing peer is made <strong>and</strong> the PNRP service can resolve<br />

the PNRP ID.<br />

Note that all this happens without you having to intervene in any way. All you have to do is ensure<br />

that peers know what to do with peer names after they have resolved them using their local<br />

PNRP service.<br />

Peers can use PNRP to locate PNRP IDs that match a particular P2P ID. You can use this to<br />

implement a very basic form of discovery for unsecured peer names. This is because if several peers<br />

expose an unsecured peer name that uses the same classifier, the P2P ID will be the same. Of course,<br />

because any peer can use an unsecured peer name you have no guarantee that the endpoint you connect<br />

to will be the sort of endpoint you expect, so this is only really a viable solution for discovery over a<br />

local network.<br />

PnrP Clouds<br />

In the preceding discussion you learned how PNRP registers <strong>and</strong> resolves peer names in clouds. A cloud is<br />

maintained by a seed server, which can be any server running the PNRP service that maintains a record of<br />

at least one peer. Two types of clouds are available to the PNRP service:<br />

➤<br />

➤<br />

Link local — These clouds consist of the computers attached to a local network. A PC may be connected<br />

to more than one link local cloud if it has multiple network adapters.<br />

Global — This cloud consists of computers connected to the Internet by default, although it is also<br />

possible to define a private global cloud. The difference is that Microsoft maintains the seed server<br />

for the global Internet cloud, whereas if you define a private global cloud you must use your own seed<br />

server. If you use your own seed server you must ensure that all peers connect to it by configuring<br />

policy settings.<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!