I am writing a Java alert program that requires each client PC to listen for a notification from the server rather than having each PC call the server every few seconds. I am trying to make the program as quiet as possible so that only the server send outs a broadcast to all network PCs when an approved user is ready to send the alert. The server will not be constantly broadcasting over the network. The issue I am having is getting the code to compile. Since there are multiple servers (client PCs in this case) I can't input an IP address because there are well over 100 PCs that need to run the instructions when the notification goes out.
Any suggestions with what needs to change would be appreciated.
package alert.bat; import java.io.*; import java.net.*; public class Alert { public static void main(String args[]) { try { DatagramSocket datsock = new DatagramSocket(444); DataOutputStream output = new DataOutputStream (datsock.getOutputStream()); output.writeUTF("Broadcast Alert!!!"); output.flush(); output.close(); datsock.close(); } catch(Exception e) { System.out.println(e); } } }