有人可以帮助我使用以下代码吗?这些方法一直运行到ss.accept();
我运行大型机的server.run
方法,直到那行代码看起来很棒。我试过调试,一旦到达那里它就停止了,没有抛出异常
public class Server extends Thread{
ServerSocket ss;
private boolean running = true;
private LinkedList<Participant> participants = new LinkedList<Participant>();
final int SERVER_PORT = 4567;
public Server(){
try{
this.ss = new ServerSocket(SERVER_PORT);
}catch(Exception e){
System.out.println("problem at...");
}
}//Constructor
public void run(){
try{
while(running){
System.out.println("35");
Socket sock = this.ss.accept();
System.out.println("39");
Participant part = null;
part = new Participant(this,sock);
participants.add(part);
part.start();
}
}catch(Exception e){
e.printStackTrace();
}
}
}//Server
答案 0 :(得分:1)
正在等待客户的请求。您是否向客户发送请求并尝试?