ClientHandler clientHandler = new ClientHandler(client,
new ClientHandler.CloseNotify() {
@Override
public void onSelfClosed(ClientHandler handler) {
clientHandlerList.remove(handler);
}
});
// 读取数据并打印
clientHandler.readToPrint();
clientHandlerList.add(clientHandler);
里面onSelfClosed方法里的 clientHandlerList.remove(handler)的方法什么时候会被调用?
理论+实践,系统且深入掌握Socket核心技术,从容应对各种Socket应用场景的不二之选
了解课程