Partager via


How TCP/IP Works, Part 1: Layers

When you use WCF, you take for granted a lot of the infrastructure that actually moves data from place to place.  TCP/IP is the backbone of the Internet, allowing computers with different hardware running different software to communicate with each other.  TCP/IP is more than just a single protocol though; it's actually a suite of protocols stacked on top of each other in layers.  There are various ways to describe the protocol layers of a networking stack.  The OSI model is a 7-layer stack that many people think is unnecessarily complicated.  I'm already going to unnecessarily complicate things by including WCF in the picture, so I'll use a slightly simpler traditional networking stack underneath.

  1. The media layer is what conveys the actual stream of bits through the network. For Ethernet, this is the cable that carries electrical signals from place to place. Try not to think too deeply about what the media layer is for a wireless network. It will make your head hurt.
  2. On top of the media layer is the link layer. The link layer consists of the network card and device drivers that handle the hardware details of interfacing with the media.
  3. On top of the link layer is the network layer. The network layer organizes messages into packets and routes those packets around different networks. This is the first layer that exhibits real organization for moving data. Below the network layer it's basically just people shouting at each other. The Internet Protocol (IP) part of TCP/IP is at this layer.
  4. On top of the network layer is the transport layer (not the WCF kind of transport). The transport layer handles connections, flow control, and end-to-end delivery of messages. A very popular transport is Transmission Control Protocol (TCP). In a normal networking stack, this is the end of the line and you just have your application from this point. In WCF, we keep going onward!
  5. The other transport layer (the WCF kind of transport) is what moves data into and out of a WCF application. You can have a TCP transport, which essentially means you've collapsed this layer with the previous layer. Or, you can have something like the HTTP transport, which traditionally was considered an application level protocol. Now, it's just a basic building block.
  6. You can add any number of additional layers by inserting channels into your channel stack. Sessions, security, message encoding, reliable messaging, and any other protocol you can think of, are layers that you can include in almost any order. I avoid using the OSI model because it really breaks down here for WCF.

Eventually though, you should reach the end of the channel stack and ascend upward into your application. There's no telling what layer number your application is going to have.

TCP and IP are only two of the protocols that make up the TCP/IP protocol suite. You'll have to wait until Monday to find out about the other protocols that keep the Internet working.

Next time: How TCP/IP Works, Part 2: Protocols

Comments

  • Anonymous
    April 07, 2006
    Where one of the standards bodies could actually be helpful: produce a taxonomy for the layered elements of middle-ware protocols. Layer 7 in modern middle-ware is rich, and it'd be great to see the commonalities between middle-ware get a proper taxonomy. Many middlewares handle message delivery guarantee for example, and on top of delivery guarantee build transactional guarantees, but what layering, and its positioning accounts for security services, etc?
  • Anonymous
    April 07, 2006
    After seeing the ChannelBase class yesterday for implementing a channel, today's post is about the base...
  • Anonymous
    April 11, 2006
    Inside each layer of the TCP/IP networking stack, there are many protocols to transmit and route information...
  • Anonymous
    April 12, 2006
    As someone that just uses WCF to get a job done, you may be wondering why it's important to know about...
  • Anonymous
    April 17, 2006
    The AppDev: Something You Should Know is a great blog to read/subscribe to, it has loads of useful...