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.

Peer-to-Peer networking overview ❘ 1341<br />

You could use P2P technology to prevent this web server collapse. Instead of sending the file directly from<br />

the server to all the clients, you send the file to just a few clients. A few of the remaining clients then download<br />

the file from the clients that already have it, a few more clients download it from those second-level<br />

clients, <strong>and</strong> so on. In fact, this process is made even faster by splitting the file into chunks <strong>and</strong> dividing<br />

these chunks among clients, some of whom download it directly from the server, <strong>and</strong> some whom download<br />

chunks from other clients. This is how file-sharing technologies such as BitTorrent work, <strong>and</strong> is illustrated in<br />

Figure 45-3.<br />

Server<br />

Clients<br />

figure 45-3<br />

P2P architectural Challenges<br />

There are still problems to solve in the file-sharing architecture discussed here. For a start, how do<br />

clients detect that other clients exist, <strong>and</strong> how do they locate chunks of the file that other clients might<br />

have Also, how can you ensure optimal communication between clients that may be separated by entire<br />

continents<br />

Every client participating in a P2P network application must be able to perform the following operations to<br />

overcome these problems:<br />

➤<br />

➤<br />

➤<br />

It must be able to discover other clients.<br />

It must be able to connect to other clients.<br />

It must be able to communicate with other clients.<br />

The discovery problem has two obvious solutions. You can either keep a list of the clients on the server so<br />

clients can obtain this list <strong>and</strong> contact other clients (known as peers), or you can use an infrastructure (for<br />

example PNRP, covered in the next section) that enables clients to find each other directly. Most file-sharing<br />

www.it-ebooks.info

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

Saved successfully!

Ooh no, something went wrong!