다음을 통해 공유


How Internet Addresses Work

We often take for granted that we can send a message off to any computer in the world and that it will get there eventually with very little intervention on our part.  Well, most of the time it gets there.  One of the overlooked players in this process is the addressing of every computer on the network.  The current standard for addressing comes from version 4 of the Internet Protocol, also known as IPv4 or simply IP.  There are new standards that attempt to fix some problems with IPv4, mainly the lack of available addresses.  However, we've been "imminently about to run out of IPv4 addresses" every year for the last 10 years, which is roughly half of IPv4's lifetime.

An IPv4 address is a 32-bit number that is used both for identifying computers and routing messages.  The most common way of writing an address is as a dotted decimal.  The address is first broken up into four 8-bit chunks.  Each chunk is then converted to a decimal number and separated from the previous chunk in writing by a dot.  This is where addresses that look like 192.168.0.1 come from.

The original addressing scheme divided the available space into a number of classes depending on the first few bits of the address.  These were called class A, B, and C addresses, and classes were used for performing routing.  Inside these classes are several blocks of reserved addresses that cannot be used for computers connected to the Internet.  The address in the previous paragraph is one of those reserved addresses.  It's a private network address, which means that anyone can use it for their purposes, but there's no way to talk to a computer with such an address without going through some intermediary.  Other commonly seen reserved addresses include the loopback addresses, which all have 127 as the first chunk.  Anything sent to one of these addresses doesn't actually go anywhere.  Instead, a message sent to a loopback address just gets sent back to the same computer.  Several years later, it became possible to route messages independently of class, making the original class system obsolete.

The reason I wrote today's post though is to talk about one of the lesser-known kinds of addresses.  All of the previously mentioned addresses refer to a single computer, called a unicast address.  There are two other groups of addresses, sometimes called class D and E.  Class D addresses run from 224.0.0.0 to 239.255.255.255.  These are called multicast addresses because they are a way to send a single message to multiple computers.  Multicasting is done using the concepts of groups.  Computers join a multicast group associated with one of the addresses to indicate that they want to receive a copy of each packet intended for the group.  Using multicasting cuts down on the total required bandwidth because many of the hops will only transmit one copy of the message regardless of how many computers are ultimately listening.

Most network applications can only be used with unicast addresses.  There's no real support for multicasting in WCF, although you can write your own multicast transport as long as you don't use any layered channels that assume that there's only one computer on the other end.  Reliable messaging and security do not work well with multicasting.  I've recently been looking at ways to make WCF more multicast friendly.  Although I don't know if this work will ever appear in the product, it's been fun exploring this different world of networking.

Next time: WCF Hello World, Part 1: Building a Client

Comments

  • Anonymous
    March 27, 2006
    >>>There are new standards that attempt to fix some problems with IPv4, mainly the lack of available addresses.  However, we've been "imminently about to run out of IPv4 addresses" every year for the last 10 years, which is roughly half of IPv4's lifetime.
    >>>
    Yes - easy for us in the US to talk when Prudential , ford , Apple , Eli Lily ,GE each have more address space then the entirety of china
  • Anonymous
    March 27, 2006
    It's not uncommon to hear people wonder how calling Abort() is different from calling Close(). ...
  • Anonymous
    April 11, 2006
    Inside each layer of the TCP/IP networking stack, there are many protocols to transmit and route information...