Transfer Modes and Buffer Sizes

Why do only some of the bindings allow setting a MaxBufferSize?

The maximum buffer size and the maximum received message size are in many ways linked together.

If the message is being transferred in a single buffer, then it only makes sense for the largest size of that buffer to equal the largest size of the message. If the message was larger than the largest buffer, then it wouldn't be possible for the message to fit in a single buffer. If the buffer was larger than the largest message, then there would be buffer space that could never be used.

On the other hand, if the message is being transferred as a stream, then the relationship between the largest buffer size and the largest message size changes. The only piece of the message that needs to fit in a single buffer is the initial group of headers at the beginning. Overall, the message might require many buffers full of data to communicate. If the message was larger than the largest buffer, then that is perfectly acceptable. It still doesn't make sense though for the buffer to be larger than the largest message since there is no way to fill a single buffer using multiple messages.

Some of the bindings can only perform buffered transfers. For example, if the binding requires making a copy of the message as it is being sent, then there isn't much point supporting anything besides buffered transfers as a buffered copy of the message will always be available. If a binding only supports buffered transfers, then there is no need to have a maximum buffer size. The only possible value the maximum buffer size could have is equal to the maximum message size, and having to enter the same size twice doesn't help you do anything besides make mistakes.

Skip to main content