This commit is contained in:
xixu-me committed 2024-07-02 08:59:55 +08:00
1 parent eda528e2c9
commit f776b88a82
13 files changed
+22 -205

No files matched your search

-6
View File
@@ -6,20 +6,14 @@ import java.net.Socket;
import server.thread.HandleThread;
public class Server {
public static void main(String[] args) throws Exception {
int port = 9999;
ServerSocket server = new ServerSocket(port);
System.out.println("服务器正在 9999 端口侦听客户端请求");
while (true) {
Socket socket = server.accept();
System.out.println("客户端" + socket.getInetAddress().getHostAddress() + "成功连接");
new HandleThread(socket).start();
}
}
}