Partager via


Windows Communication Foundation Channel Shapes

The WCF channel model has three built-in archetypes for communication patterns.  These archetypes are the one-way pattern, unmatched two-way pattern, and matched two-way pattern.  Along with the archetypes are five interfaces, called channel shapes, that describe the send and receive methods for each pattern.  There is one interface for the client and server side of each pattern, except for unmatched two-way where the two endpoints have the same behavior.

In the one-way communication pattern, there is a unidirectional stream of messages between the client and server.  One end of the pair will have an IInputChannel for receiving messages and the other end will have an IOutputChannel for sending messages.  In a queueing system, you might have writers that put messages into the queue and a reader that processes messages from the queue.  Such a system would use the one-way pattern to indicate that there's no way to flow messages through the queue in the other direction.

In the unmatched two-way communication pattern, there's essentially a pair of one-way patterns welded together.  Each side has an input and output channel, joined together by an IDuplexChannel, that they can use independently.  Once you've established a bidirectional TCP connection, both sides of the connection can read and write messages at any time.

Finally, in the matched two-way communication pattern, there is still an input and output channel on both sides, but there's a semantic restriction on when messages can be sent.  The client can send requests to the server, through an IRequestChannel, and the server can send a reply back the client, through an IReplyChannel.  The client and server have to maintain this pairing because only one side is expected to talk on the channel at a time.  This is the model that HTTP uses for communication.

We've got some other obligations to take care of this week, but we'll spend next week looking at each of these interfaces in detail.

Next time: Get the Message

Comments

  • Anonymous
    March 07, 2006
    I've been giving a tour around the WCF channel stack without ever really explaining what channels are. ...
  • Anonymous
    March 13, 2006
    Николас объясняет буквально "на пальцах". Честно говоря, все эти вопросы — кто п
  • Anonymous
    March 14, 2006
    Last week I introduced the different kinds of channel shapes that are available with WCF.  This...
  • Anonymous
    March 28, 2006
    During the past month, we've taken a tour of the most important parts of the channel model.  We...
  • Anonymous
    June 08, 2006
    I've talked about the request-reply message exchange pattern that HTTP uses, but we've never looked at...
  • Anonymous
    June 22, 2006
    When you build a channel factory or listener, you have to specify a TChannel parameter that describes...
  • Anonymous
    March 09, 2007
    I was looking through the archives the other day and found that the original article on channel shapes