In the future, most programmers who want to write peer-to-peer applications will use a third-party platform rather than creating the infrastructure from scratch. The two platforms shown in this chapter are useful choices, but they won't meet the needs of all developers. Windows Messenger is primarily suited for small-scale implementations, particularly when adding peer-to-peer messaging to an existing application. Groove is a more comprehensive platform that's well suited to creating all types of collaborative applications. In this section, we'll consider two other choices.
Windows Messenger isn't the only instant-messaging platform—AOL provides a similar product, as does the pioneer, ICQ. It's possible to use these protocols, and there are some open-source projects dedicated to the task, but there are currently no .NET components that make it easy. Thus, if you want to use these other platforms, you need to study the platform and write a significant amount of custom code with .NET's networking classes.
The same is true of Gnutella, the fully decentralized protocol used for file sharing. There is a decentralized set of Java classes (known as JTella and available at http://jtella.sourceforge.net) that provides this functionality for Java applications, but there is currently no .NET equivalent, although there are several in-progress projects on SourceForge.net and at least one attempt to port the JTella logic to C#.
In addition, for the truly ambitious, information about the Gnutella protocol can be found at http://rfc-gnutella.sourceforge.net and various other locations on the Internet. There is currently one Gnutella client totally implemented on the .NET platform using C# code. It's Swapper.NET by Jason Thomas, which is available for download (in compiled form only) at http://www.revolutionarystuff.com/swapper.
Microsoft's DirectX includes DirectPlay, a technology that's designed with peer-to-peer game play in mind. DirectPlay can be used in a server-based or pure peer-to-peer environment. Either way, it plays the same role: completely managing network communication and data exchange. Generally, a developer will use DirectPlay to keep multiple peers synchronized in a multiplayer game, although the technology is impressive enough that it could conceivably be incorporated into a variety of different application types.
Some of the features that DirectPlay offers include group management (registration and deregistration of users), bandwidth management that allows large amounts of data to be exchanged without introducing problems, and connection statistics. DirectPlay also includes a variety of message services, such as guaranteed delivery and guaranteed sequencing, both of which are optional. DirectPlay even includes a related API named DirectPlay voice, which is fine-tuned for real-time voice communication between players.
To learn about DirectPlay, you can download the full DirectX 9.0 SDK for .NET from http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp. You can also refer to .NET Game Programming with DirectX 9.0 (Apress 2003), which includes a full chapter on the subject.
It may be that the infrastructure for peer-to-peer systems won't be built-in to the next generation of programming toolkits, but rather into the next generation of Windows. Microsoft has recently released a peer-to-peer upgrade for Windows XP that adds decentralized peer connectivity features, and a peer-to-peer SDK with examples (currently all in unmanaged code). To download the update and the SDK, visit http://msdn.microsoft.com/library/default.asp?url=/downloads/list/winxppeer.asp.
However, there's one huge limitation: These technologies rely in large part on the next generation of Internet addressing technology, IPv6. Even though there are facilities to "work through" NATs based on IPv4, the solution is far from complete, and it will be some time before it matures into a practical platform for building applications. But you can get a head start on this emerging field by referring to Microsoft's peer-to-peer networking home page, http://www.microsoft.com/windowsxp/p2p.