?? roomlisten.java
字號:
package freech.core;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
//一個房間一個線程
public class RoomListen extends Thread {
ServerSocket ssl = null;
int count = 0;//線程調試數據
int port = 0;//線程調試數據
public RoomListen(ServerSocket ssl,int i,int port) {
this.ssl = ssl;
this.count = i;
this.port = port;
}
public void run() {
System.out.println("RoomListen count is "+count);
System.out.println("RoomListen port is "+port);
Accept(this.ssl);
}
private void Accept(ServerSocket ss) {
int j = 0;//線程調試數據
while (true) {
try {
Socket s = ss.accept();
new ClientThread(s,j,port).start();//開始客戶線程
j++;
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -