In this chapter, you learned how a pipe can be bound to an endpoint to send data to or receive data from a remote peer. To demonstrate the use of the Pipe service, this chapter used a set of Pipe Advertisement files generated by the PipeAdvPopulator class. Although these files simplified the examples, it should be realized that in real applications, Pipe Advertisements usually are obtained using the Discovery service.
This chapter also examined the BidirectionalPipeService, a pseudo-service built on top of the Pipe service. The BidirectionalPipeService provides a simple mechanism for peers to establish two-way communications using two pipes. The advantage of this mechanism is that only one Pipe Advertisement must be published or discovered because the BidirectionalPipeService handles negotiation of a second Pipe Advertisement. This mechanism also has the advantage that it eliminates some of the code required to manage two pipes.
Pipe Advertisements aren't usually published by themselves, but they are usually contained within another advertisement. As you'll see in Chapter 10, "Peer Groups and Services," a Pipe Advertisement is usually associated with a service, allowing a remote peer to interact with a service through the pipe.