The Windows Communication Foundation's Peer Channel makes it easy to use the facilities of the Windows Peer-to-Peer Networking infrastructure to construct applications involving the exchange of structured data among peers. Peer Channel applications, like any Windows Communication Foundation applications, are defined by an address, a binding, and a contract. The addresses must have netP2P as the scheme. The binding is the NetPeerTcpBinding. The contracts must be defined with themselves as their callback contracts. A behavior, PeerBehavior, is provided for publishing and subscribing to the events of coming online and going offline. On Windows XP SP2, and other operating systems with the Windows Peer-to-Peer Networking infrastructure, peer name resolution can be left to that infrastructure. On other operating systems, such as Windows Server 2003, it is necessary to provide a peer name resolution service, which is easy to build as an implementation of the abstract PeerResolver class. While the exchange of messages via Peer Channel may be secured using a symmetric secret, access to the peer name resolution service can be controlled in a wider variety of ways, providing an additional layer of defense for sensitive peer-to-peer applications. |