Welcome to MSDN Blogs Sign in | Join | Help

Stream Upgrades, Part 1

The next several posts are about the stream upgrade model for modifying the byte stream output of a transport. I'll use these posts to cover the basic elements of the stream upgrade model, take a break for a while to talk about some other topics, and later have a sample that shows building a stream upgrade from scratch.

A stream upgrade takes the output from message serialization and replaces that byte stream with another byte stream. Stream upgrades are represented in the channel stack by a binding element that doesn't actually create a channel. It is legal to have more than one stream upgrade in the channel stack and active at the same time. These stream upgrades chain sequentially so that the stream output of one is passed as the stream input to the next one. Our primary use of stream upgrades is to provide transport security by replacing the unencrypted stream with an encrypted stream. You could also use stream upgrades for tasks such as compression, character re-encoding, or byte reordering.

public abstract class StreamUpgradeBindingElement : BindingElement
{
protected StreamUpgradeBindingElement();
protected StreamUpgradeBindingElement(StreamUpgradeBindingElement elementToBeCloned);

public abstract StreamUpgradeProvider BuildClientStreamUpgradeProvider(BindingContext context);
public abstract StreamUpgradeProvider BuildServerStreamUpgradeProvider(BindingContext context);
}

Building a client or server StreamUpgradeProvider is very similar to constructing a ChannelFactory or ChannelListener for a particular channel. The StreamUpgradeProvider class will be the topic of tomorrow's post.

Since there's no channel corresponding to the stream upgrade, the transport is the part of the channel stack that's responsible for actually creating and using the stream upgrade. This means that stream upgrades are only going to be supported by certain transports. Our named pipe and TCP transports, the connection-oriented transports, both support stream upgrades. These transports provide connections that flow undelimited streams of bytes, meaning that they mesh well with the stream upgrade model. Our HTTP transport does not support stream upgrades.

Applying a stream upgrade to a connection is optional. The stream upgrades included in the channel stack represent the maximum collection of upgrades that can be used with a connection. The client and server sides have to negotiate and agree on the collection of stream upgrades that will be used for a particular collection. The process for negotiation is covered in a later post.

Next time: Stream Upgrades, Part 2

Published Thursday, September 07, 2006 5:00 AM by Nicholas Allen

Comments

Thursday, September 07, 2006 12:19 PM by Nicholas Allen's Indigo Blog

# You Must Understand This

WCF allows you to customize the collection of message headers sent with a request, including defining...
Monday, September 11, 2006 12:13 PM by Nicholas Allen's Indigo Blog : Stream Upgrades, Part 2

# Nicholas Allen's Indigo Blog : Stream Upgrades, Part 2

Tuesday, September 12, 2006 12:22 PM by Nicholas Allen's Indigo Blog

# Stream Upgrades, Part 3

Today’s the final part of the series on the stream upgrade model (StreamUpgradeBindingElement and StreamUpgradeProvider...
Thursday, September 28, 2006 11:58 AM by Nicholas Allen's Indigo Blog

# ROT 128 Stream Upgrade Sample, Part 1

The mission for the next five days is to build and demonstrate an implementation of a stream upgrade....
Friday, September 29, 2006 12:04 PM by Nicholas Allen's Indigo Blog

# ROT 128 Stream Upgrade Sample, Part 2

Building a stream upgrade for ROT 128 starts with creating a binding element to put in the channel stack....
Sunday, October 08, 2006 6:59 PM by Nicholas Allen's Indigo Blog

# Stream Upgrades, Part 3

Today’s the final part of the series on the stream upgrade model ( StreamUpgradeBindingElement and StreamUpgradeProvider

Sunday, October 08, 2006 6:59 PM by Nicholas Allen's Indigo Blog

# Stream Upgrades, Part 2

The stream upgrade model consists of four abstract base classes. We looked at the StreamUpgradeBindingElement

New Comments to this post are disabled
 
Page view tracker