Message framing is the breaking up of a stream of data into demarcated units called messages. Some protocols, such as HTTP, natively include a notion of message framing. Other protocols, such as TCP, don't natively include a notion of message framing and need to be augmented with one to be used in a messaging system. WCF includes a message framing protocol called .Net Message Framing for use with transports that don't natively support messaging. This framing protocol is used with the TCP transport to create NetTcp and the MSMQ transport to create NetMsmq. The classes used by the message framing protocol aren't public but after reading this series you should know enough about how the protocol works to put together your own implementation that does most of .Net Message Framing.
The basic operation of .Net Message Framing is to first exchange some metadata about how messages will be exchanged and then to exchange the messages themselves. The metadata includes information such as the version of the framing protocol being used and the algorithm for encoding the messages. The messages can be transmitted in a variety of formats and, if something goes wrong with the exchange, transmission can be aborted to allow the connection to be reused.
The message framing protocol works by sending a series of typed records. Each record is prefixed with a single byte that indicates the record type. There are a few different legal orders of records depending on which mode the message framing protocol is being used in. Here are all of the possible record types along with the type number of each record. Next time, I'll start going into these record types to explain how the message exchange metadata works.