Summary Broadcasting is a powerful technique for discovering resources on the local area network. Sending broadcasts is simple, provided that you know the correct subnet-directed broadcast IP address to use. If not, you can determine it at runtime using the IO::Interface module (either the pure-Perl version developed here or the C extension module available from CPAN). Receiving broadcasts is even easier. Any datagram-based server will receive broadcasts without any overt action on the programmer's part. Broadcasting has some important limitations. It is useful only in the local area subnetwork because routers will not forward broadcast packets. Broadcasting is not selective. A host machine cannot opt out of receiving broadcasts any more than a TV antennae can opt out of receiving television broadcasts. The operating system receives and processes every broadcast sent to it, even those that no user -level application is interested in reading. For this reason, avoid overuse of broadcasts. The way around these limitations is to use multicasting, to which we turn in the next chapter. |