Thursday, September 8, 2011

Broadcasting on 255.255.255.255


The special broadcast address 255.255.255.255 can also be used for broadcasting. Although this form of the address might suggest a broadcast to the world, it is much more limited than that. This type of broadcast is never forwarded by a router, whereas a more specific broadcast address (such as 192.168.0.255) might be forwarded, depending upon the router's configuration.

The notion of a general broadcast address like 255.255.255.255 is not very well defined. For example, some flavors of UNIX interpret this to mean that a broadcast should take place on all network interfaces for that host. Other UNIX kernels will choose only one of several interfaces— usually the first one defined. This becomes a serious issue when a host has more than one network interface card (or NIC for short). For this reason, the use of the general broadcast address is generally discouraged.

If it becomes necessary to broadcast out of every network interface, then your software should perform the following steps prior to a broadcast:
  1. Determine the next (or first) interface name. 
  2. Determine the interface's broadcast address. 
  3. Broadcast using that interface's broadcast address. 
  4. Repeat steps 1 through 3 for all additional network interfaces that are active (that is, "up") in the system.
After these steps have been performed, you can be assured that a broadcast has been made on every interface of your software.
The remainder of this chapter will focus on how to broadcast out of one network interface. After you have mastered this concept, you can then apply the preceding procedure if it becomes necessary to broadcast out of every interface.

No comments:

Post a Comment