my housemate's TV has a very good, well-designed IP service discovery mechanism that i've never seen before:
instead of relying on potentially unreliable information like the netmask to determine the broadcast address, it simply replaces random octets of the address with "255", then sends UDP packets to that address.
so for example, if its IP address is 1.2.3.4, it'll send packets to 1.2.3.255 and 1.2.255.255.
i see nothing that can go wrong with this approach! well, aside from the fact that the addresses 1.2.3.255 and 1.2.255.255 are not on our network, so it's actually sending these discovery packets to random Internet hosts...