📄 datwatch.java
字号:
import java.net*;
public class DayWatch {
private DatagramSocket ds;
private DatagramPacket dp;
public static void main(String[] ars) throws Exception {
DatWatch d = new DatWatch();
d.go();
}
public void go() throws Exception {
byte[] buff = new byte[64];
String s;
ds = new DatagramSocket(DayBcast.DAYTIME_POR);
dp = new DatagramPacket(buff,buff.length);
for (;;) {
ds.receive(dp);
s = new String(dp.getData());
System.out.println("Time signal received from "+dp.getAddress()+" Time is: "+s);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -