当服务器等待来自客户端的连接时,如何阻止套接字的accept方法? 我的代码在这里:
ServerSocket serverSocket = null;
try {
serverSocket = new ServerSocket(4444, 100);
} catch (IOException e) {
System.err.println("Could not listen on port: 4444.");
System.exit(1);
}
Socket clientSocket = null;
try {
clientSocket = serverSocket.accept();
// Thread input = new InputThread(clientSocket.getInputStream());
} catch (IOException e) {
System.err.println("Accept failed.");
System.exit(1);
}
我想阻止等待客户端的accept方法..