How can I send broadcast packets in Java?
Broadcasting is defined as sending a packet to all network nodes on a subnet. An IP network subnet mask divides an IP address into two parts: the network identifier and the node identifier. A broadcast address is defined as an IP address where all bits of the node identifier are set. For example, www.jguru.com has an IP address of 184.108.40.206 and a subnet mask of 255.255.255.0. In this case, the network identifier is 216.217.9, and the node identifier is 172. Using the above definition, the broadcast address for this subnet would be 220.127.116.11.
So, sending a broadcast packet from a Java program (or from a program in any other language, for that matter) simply requires you to specify the broadcast address as the destination for the packet.