Connection-Oriented Bindings

Connection-oriented transports such as named pipes and TCP are ideal for crossing process and machine boundaries, and yield greater performance and reliability than HTTP transport. Named pipes support reliable and sequential data transfer (FIFO) via memory-mapped files. Communications may be handled over one-way pipes (caller writes, receiver reads), or half-duplex (both caller and receiver read and write to the pipe—just not at once). TCP sockets, on the other hand, provide endpoints through which caller and receiver communicate, as a full-duplex implementation (two-way).

WCF provides standard bindings for both of these protocols. NetNamedPipeBinding wraps communication over named pipes, and limits that communication to the same machine for security reasons (you can be certain your named pipe endpoints cannot be called remotely). NetTcpBinding enables TCP socket communication for RPC and streaming scenarios. In this section, I’ll show you how to work with NetNamedPipeBinding and NetTcpBindng endpoints and discuss scenarios in which each binding is most applicable. You’ll complete a lab first to put them to use, and then I’ll dig into the details.

Tip

NetPeerTcpBinding is also based on the TCP protocol, offering peer-to-peer communications. This binding has implications beyond WCF and is too broad to cover in this book.

Lab: Distributing Calls with NetNamedPipeBinding and NetTcpBinding

In this lab, you will turn a two-tier web application into an ...

Get Learning WCF now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.