listen.java

来自「网络围棋」· Java 代码 · 共 30 行

JAVA
30
字号
import java.io.*;import java.net.*;public class Listen extends Thread{    Socket socket;    MainWindow mainWindow;    public Listen(Socket socket,MainWindow mainWindow)    {        this.socket=socket;        this.mainWindow=mainWindow;    }    public void run()    {        try        {            this.activeListen(this.socket);        }catch(IOException ioe){this.mainWindow.panelGo.showError("意外中断");}    }    void activeListen(Socket socket) throws IOException    {        BufferedReader reader=new BufferedReader(new InputStreamReader(socket.getInputStream()));        String message;        while(true)        {            message=reader.readLine();            this.mainWindow.doMessage(message);        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?