import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.Socket; public class ReadWriteSocket{ public static void whois(String query, String server) throws IOException{ Socket socket = new Socket(server, 43); int c = 0; OutputStream os = socket.getOutputStream();//写 InputStream in = socket.getInputStream();//读 query += "\r\n"; os.write(query.getBytes("iso8859_1"));//所得 byte 数组 while(c != -1){ c = in.read();//读完 if(c != -1){ System.out.print((char) c);//打印出来 } } } public static void main(String[] args) throws Exception{ String hostName = "whois.networksolutions.com"; whois("query", hostName); } } /** NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of high-volume, automated, electronic processes. The Data in Network Solutions' WHOIS database is provided by Network Solutions for i nformation purposes only, and to assist persons in obtaining information about or related to a domain name registration record. Network Solutions does not guarantee its a ccuracy. By submitting a WHOIS query, you agree to abide by the following terms of use: You agree that you may use this Data only for lawful purposes and that under no circumstances will you use this Data to: (1) allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via e-mail, telephone, or facsimile; or (2) enable high volume, automated, electronic processes that apply to Network Solutions (or its computer systems). The compilation, repackaging, dissemination or other use of this Data is expressly prohibited without the prior written consent of Network Solutions. You agree not to use high-volume, automated, electronic processes to access or query the WHOIS database. Network Solutions reserves the right to terminate your access to the W HOIS database in its sole discretion, including without limitation, for excessive querying of the WHOIS database or for failure to otherwise abide by this policy. Network Solutions reserves the right to modify these terms at any time. Get a FREE domain name registration, transfer, or renewal with any annual hostin g package. http://www.networksolutions.com No match for "QUERY". 公告及使用条款:您没有被授权访问或查询我们的WHOIS 数据库通过使用高容量,自动化,电子流程。 “ 网络解决方案“WHOIS数据库中的数据网络解决方案是由我 nformation 仅供参考,并协助在获取信息的人或相关 一个域名注册记录。网络解决方案并不能保证它的一个 ccuracy。 提交WHOIS查询,您同意遵守以下使用条款: 您同意,你可以使用这个数据仅用于合法的目的,在任何 的情况下,你会使用这个数据:(1)允许,使,或以其他方式支持 传输质量不请自来,商业广告或招揽 通过电子邮件,电话或传真;或(2)使大批量,自动化, 适用于网络解决方案(或其计算机系统)的电子流程。 “ 汇编,重新包装,传播或其他使用此资料是明确 禁止未经事先书面同意的网络解决方案。您同意不 使用 高容量,自动化,电子流程,以访问或查询的WHOIS 数据库。网络解决方案公司有权终止您访问的W 院校校长 自行决定,包括但不限于过多的数据库中, 查询WHOIS数据库或失败,否则遵守这项政策。 网络解决方案公司保留随时修改这些条款的权利。 获取一个免费域名注册,转让,任何年度hostin或重建 G封装。 http://www.networksolutions.com “QUERY”的匹配。 “Google 翻译”适合以下用途:搜索 手机 聊天 商务:译者工具包 全球商机洞察 网站翻译器 关于 Google 翻译关闭即时翻译隐私权政策帮助 */
19. 12. 3. 用socket读写 Read and write through socket
最新推荐文章于 2022-11-07 15:55:13 发布