One of the “niche” features in WCF that deserves a lot more attention than it is getting is our P2P support. The NetPeerTcpBinding looks, from the developer perspective, mostly like any other binding. The main difference between P2P applications and “normal” client/server apps is, of course, that they are serverless. Hence, P2P apps are commonly based on message exchanges where every peer node in a mesh talks to everyone else in a broadcast fashion and that model favors (but doesn’t require) symmetric duplex contracts*
When I say that it works like mostly any other binding, I really only mean the developer experience. The NetPeerTcpBinding packs so much network intelligence under its hood that it boggles the mind. The P2P technology underneath will figure out the optimal layout for a peer mesh, propagate messages through the mesh in an optimal fashion using members of the mesh as routers as appropriate. You can hook in filters to control the message propagation, you can control the hop counts, there are detection mechanisms for when a party gets split off the mesh and reconnects, and there are various ways to secure your meshes. And you basically get all the stuff for free if you just pick that binding and configure it.
The Peer Channel team has a blog, too. Links to samples:
(a) Basic NetPeerTcpBinding samples – Uses the PNRP resolver mode
(b) Scenario samples:
(i) Chat – Demonstrates Chat using the non-PNRP custom resolver
(ii) Custom Resolver – Demonstrates how to write your own Custom Resolver service and client.
* A symmetric duplex contract defines itself as the callback contract:
[ServiceContract(CallbackContract = typeof(IChat))]
public interface IChat