다음을 통해 공유


One of these Things is Not Like the Others (Channel vs. Transport)

Every time you want to send someone a message, that message first has to make its way through something we call the channel stack.  A channel is just an object that implements some particular interfaces for handling messages.  The channel stack is a collection of these channel objects, which you can visualize as being stack one atop another.  When sending a message, each channel passes the send request down to the next lower channel until the bottommost channel actually transmits the message.  Receiving a message works the opposite way.  The bottommost channel receives some bytes, creates a message, and then that message bubbles up through the channel stack until it reaches the application.

Here's the concept in a picture:

There are actually two kinds of channels in this diagram.  The bottommost channel is called a transport and is responsible for converting between a message and bytes on the network.  There can only be one transport in the channel stack and it must be the channel at the bottom because once you convert the message to bytes, you don't have a message object anymore to give to another channel.  You also really need a transport because eventually you have to stop passing the message around between channels and send it out to someone.  We support out-of-the-box a number of basic transports such as TCP/IP and HTTP.

All of the channels on top of the transport are called protocol channels.  A protocol channel transforms a message into a different message, such as the chunking channel we looked at before.  Putting protocol channels in the channel stack allows you to change what content you put on the network without changing how you actually go about putting bits on the network.  The big advantage you get with the WCF channel stack over other networking technologies is flexibility.  Since the channels are all accessed through the same few basic interfaces, it's possible to do some fairly dramatic reconfigurations of the channel stack without changing any of the application code.  Over the next month I'll be doing a whirlwind tour of the interfaces involved in creating, connecting, and using channels.

Next time: Introducing ICommunicationObject

Comments

  • Anonymous
    February 21, 2006
    One of the fundamental things that has followed us around through more product name changes than you...
  • Anonymous
    March 03, 2006
    I've briefly covered protocol channels and transport channels in the past, which transform and transmit...
  • Anonymous
    March 06, 2006
    Back to the subject of bindings, a binding is what ties together the description of a channel stack. ...
  • Anonymous
    July 14, 2006
    On Tuesday, I left off the discussion of the messaging framework with the messaging layer, which sits...