gamelistenerthread.java
来自「sun官方网站Swing的指南(English)」· Java 代码 · 共 33 行
JAVA
33 行
package bingo.shared;import java.net.*;import java.io.*;public class GameListenerThread extends ListenerThread { private GameListener notifyee; public GameListenerThread(GameListener notifyee) throws IOException { super(Constants.GameListeningGroup); this.notifyee = notifyee; } public synchronized void run() { DatagramPacket packet; while (stopListening == false) { byte[] buf = new byte[256]; packet = new DatagramPacket(buf, 256); try { socket.receive(packet); byte[] rcvd = packet.getData(); String dataString = new String(rcvd); notifyee.updateStatus(dataString); } catch (IOException e) { // PENDING: what goes in here? } } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?