Network programming for PyS60 (XI)

by Marcelo Barros

We have already talked about IP addressing in the post IV, but at that time we avoided more details about the subject “multicast addressing”. It is time to address this topic again.
IP multicast is a special addressing where it is possible to create one-to-many communications. In this case, the same IP package can reach different destinations, saving bandwidth and time. This feature makes an multicast IP address very special since it is not related to any specific network interface but instead to a group of machines. In this case, computers that want to receive data on such multicast IP need to join to this group beforehand. Unfortunately, it is not possible to understand multicast without a previous comprehension about how IP addresses are translated into physical addresses. I will try to bring this issue to light in the next paragraphs.

Each network interface has its own physical address. This address is called MAC (Medium Access Control). The MAC is a 48 bits number that must be unique for each network interface within a subnetwork. This subnetwork may be understood as a physical network consisting of one or several network segments interconnected by layer one or layer two network devices, like repeaters and hubs (layer one) or bridges and switches (layer two). However, they may repeat if network segments are interconnect by IP routers (layer three). Typical MAC address are represented as six hexadecimal numbers with eight bits and separated by colons, like 00:1E:68:BB:49:AB.

MACs are essential to deliver packages that come from IP layer since network interfaces only deal with physical addresses, not IPs (see figure below). So, in order to translate IP addresses (IP layer) into MAC addresses (data link layer), the ARP protocol is employed. Using ARP requests, tables for translating IP into MACs addresses are created in all networked nodes (called ARP cache), allowing translations and posterior delivery.

TCP/IP layers and encapsulation

But a question arises about multicast addressing: how to deliver a message if we have multiple destinations ? In this case, an special MAC address not tied to any network interface is created from the original multicast IP. Moreover, all nodes that belongs to that multicast group must program their network interface to receive messages addressed to that specific MAC address and not only to their own MAC address. Confused ? A little bit. In the next figure is illustrated how the multicast IP is mapped to the MAC address 01:00:5E:4A:14:1E.

Multicast to MAC mapping

Special socket options are used to joint to multicast groups, creating special filters for corresponding MAC addresses in the network interface. But you will need to wait the next post to understand how to put this knowledge in practice. See you there !

Related posts:

  1. Network programming for PyS60 (IV) Network programming is innocuous if you don't have at least...
  2. Network programming for PyS60 (XIII) In our last post we talked about multicast, a special...
  3. Network programming for PyS60 (XII) Until now we have used only TCP in our examples...
  4. Network programming for PyS60 (V) Before some more practicing, it is time to finish the...
  5. Network programming for PyS60 (XV) As discussed in post III, TCP sockets have flow...

Related posts brought to you by Yet Another Related Posts Plugin.