Sending and Receiving Broadcasts


 
Network Programming with Perl
By Lincoln  D.  Stein
Slots : 1
Table of Contents
Chapter  20.   Broadcasting

    Content

Broadcasting Explained

Broadcasting is an old technology that dates back to the earliest versions of TCP/IP. It is a nonselective form of the UDP protocol in which messages placed on the local subnet are received and processed by each host on the network. Because broadcasting is gregarious, it is strictly limited to the local subnet. Unless deliberately configured otherwise , routers refuse to forward broadcast packets across subnet boundaries.

Broadcasting is implemented using a special IP address known as the "broadcast address." As explained in Chapter 3, the broadcast address is an IP address whose host part is replaced by all ones. For example, for the class C network 192.168.3.124, the host part of the address is the last byte, making its broadcast address 192.168.3.255. Strictly speaking, this is known as the "subnet directed broadcast address," because the address is specific to the subnetwork. There are several other types of broadcast addresses, the only one of which still regularly being used is the "all-ones" broadcast address, 255.255.255.255. We will discuss this address later.

To broadcast a message, an application sends out a UDP datagram directed toward a network port and the broadcast address for the network. The message will be distributed to all hosts on the local network and picked up by any broadcast-capable network cards (Figure 20.1). The message is then passed up to the operating system, which checks whether some process has bound to the port that the message is addressed to. If there is such a socket, the message is handed off to the program that owns it. Otherwise, the message is discarded.

Figure 20.1. Broadcast packets are received by all hosts on the local Subnet and either passed to a listening application or discarded

graphics/20fig01.gif

Broadcasting is indiscriminate. All broadcast-capable interface cards attached to the network receive broadcast packets and pass them up to the operating system for processing. This is in contrast to unicast packets, which are ordinarily filtered by the card and never reach the operating system. Thus, excessive use of broadcasting can have a performance impact on all locally connected hosts because it forces the operating system to examine and dispose of each irrelevant packet.

Broadcast Applications

Despite its limitations, broadcasting is extremely useful. Network broadcasts are used in the following categories of application:

  • Resource Discovery Broadcasts are frequently used when you know that there is a server out there somewhere but you don't know its IP address in advance. For example, the DHCP uses broadcasts to locate a DHCP server and to retrieve network configuration information for a client that is booting. Similarly, the Network Information System (NIS) clients use broadcasts to locate an appropriate NIS server on the local network.

  • Route Information Routers must exchange information in order to maintain their internal routing tables in a consistent state. Some routing protocols use periodic broadcasts to advertise routes and to advise other routers of changes in the network topology.

  • Time Information The Network Time Protocol (NTP) can be configured so that a central time server periodically broadcasts the time across the LAN. This allows interested hosts to synchronize their internal clocks to the millisecond.

Broadcasting is a core part of the IPv4 protocol and is available on any operating system that supports TCP/IP networking.


   
Top


Network Programming with Perl
Network Programming with Perl
ISBN: 0201615711
EAN: 2147483647
Year: 2000
Pages: 173

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net