ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
![](https://box.kancloud.cn/e4154cd3921f3c666239f634816c1489_664x231.png) ![](https://box.kancloud.cn/9343fb8616794618cd806a18f4b97a89_643x273.png) ServerThread.java ~~~ import java.net.ServerSocket; import java.net.Socket; public class ServerThread extends Thread{ Server father; //声明Server的引用 ServerSocket ss;//声明ServerSocket的引用 boolean flag=true;//z操作线程的生存期 public ServerThread(Server father) {//构造器 this.father=father; ss=father.ss; } public void run() { while(flag) { try { Socket sc=ss.accept();//等待客户端连接 //ServerAgentThread sat=new ServerAgentThread(father,sc); //sat.start();//创建并启动服务器代理线程 } catch(Exception e) { e.printStackTrace(); } } } } ~~~