package lc.mecha.net;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class Broadcast {
    public static void broadcast(InetAddress destination, int port, byte[] data) throws IOException {
        DatagramSocket socket = new DatagramSocket();
        socket.setBroadcast(true);
        DatagramPacket packet = new DatagramPacket(data, data.length, destination, port);
        socket.send(packet);
        socket.close();
    }
}
