datwatch.java
来自「翁剀JAVA语言那门课程的教案 很多人都看多他的视频教程可惜没有ppt的教案」· Java 代码 · 共 23 行
JAVA
23 行
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 + =
减小字号Ctrl + -
显示快捷键?