import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.Date;
public class UdpServerSocket {
public static void main(String[] args) throws Exception {
while (true) {
DatagramSocket ds = new DatagramSocket();
String str = new Date().toString();
DatagramPacket dp = new DatagramPacket(str.getBytes(), str.length(),
InetAddress.getByName("255.255.255.255"), 514);
ds.send(dp);
ds.close();
}
}
}
255.255.255.255,为广播,也可以写固定IP