?? server.java
字號(hào):
package test;
import java.net.*;
import java.io.*;
import java.util.Hashtable;
import test.Communicate;
import test.*;
public class Server {
public static void main(String[] args) {
try
{
ServerSocket ss = new ServerSocket(8082);
Hashtable sockets = new Hashtable();
boolean b = true;
while(b)
{
System.out.println("等待客戶端的連接......");
Socket s = ss.accept();
System.out.println("客戶端"+s.getInetAddress().getHostName()+"連接!");
sockets.put(s.getInetAddress().getHostName(), s);
new Thread(new Communicate(s, sockets)).start();
}
ss.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -