?? udpwatch.java
字號:
import java.net.*;
public class UdpWatch{
private DatagramSocket ds;
private DatagramPacket dp;
public static void main(String[] args)throws Exception{
UdpWatch d = new UdpWatch();
d.go();
}
public void go()throws Exception{
byte[] buff = new byte[64];
String s;
ds = new DatagramSocket(Udp.PORT);
dp = new DatagramPacket(buff,buff.length);
while(true){
ds.receive(dp);//hui zu se, wait();
s = new String(dp.getData());
System.out.println("From"+dp.getAddress()+": "+s);
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -