Search code examples
asp.net.netweb-serviceswcfwcf-binding

Differences between NetTcpBinding and NetPeerTcpBinding


What is the practical difference between NetTcpBinding and NetPeerTcpBinding in WCF? When should I pick one over another?


Solution

  • Peer Network binding

    This binding is provided by the NetPeerTcpBinding class. It uses TCP protocol but uses peer net-working as transport. In this networking each machine (node) acts as a client and a server to the other nodes. This is used in the file sharing systems like torrent.

    TCP binding

    This binding is provided by the NetTcpBinding class. It uses TCP protocol for communication be-tween two machines with in intranet (means same network). It encodes the message in binary format. This is faster and more reliable binding as compared to the Http protocol bindings. It is only used when communication is WCF - to – WCF means both client and service should have WCF.

    More info about bindings: Bindings

    In simple words: practical difference is that NetTCP have server side and client side applications, in peer2peer application is working for both client, and server for other clients. P2P is good for file shering (like torrent). NetTCP is better for "normal" apps, where you have server with connection to data store, and clients who use server to get access to data, and server logic.