⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 client.java

📁 linux下建立JAVA虚拟机的源码KAFFE
💻 JAVA
字号:
// Copyright (c) 2005 Brian Wellington (bwelling@xbill.org)package org.xbill.DNS;import java.io.*;import java.net.*;import java.nio.channels.*;import org.xbill.DNS.utils.hexdump;class Client {protected long endTime;protected SelectionKey key;protectedClient(SelectableChannel channel, long endTime) throws IOException {	boolean done = false;	Selector selector = null;	this.endTime = endTime;	try {		selector = Selector.open();		channel.configureBlocking(false);		key = channel.register(selector, 0);		done = true;	}	finally {		if (!done && selector != null)			selector.close();		if (!done)			channel.close();	}}static protected voidblockUntil(SelectionKey key, long endTime) throws IOException {	long timeout = endTime - System.currentTimeMillis();	int nkeys = 0;	if (timeout > 0)		nkeys = key.selector().select(timeout);	else if (timeout == 0)		nkeys = key.selector().selectNow();	if (nkeys == 0)		throw new SocketTimeoutException();}static protected voidverboseLog(String prefix, byte [] data) {	if (Options.check("verbosemsg"))		System.err.println(hexdump.dump(prefix, data));}voidcleanup() throws IOException {	key.selector().close();	key.channel().close();}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -