资源简介
java.net官网下载的源码。建议认真阅读源码中的README-builds.html文档,编译过程中需要注意很多细节。
代码片段和文件信息
/*
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not write to the Free Software Foundation
* Inc. 51 Franklin St Fifth Floor Boston MA 02110-1301 USA.
*
* Please contact Oracle 500 Oracle Parkway Redwood Shores CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import com.oracle.net.Sdp;
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.*;
/**
* Exercise com.oracle.net.Sdp with each IP address plumbed to InfiniBand
* interfaces listed in a given file.
*/
public class Sanity {
public static void main(String[] args) throws Exception {
// The file is a list of interfaces to test.
Scanner s = new Scanner(new File(args[0]));
try {
while (s.hasNextLine()) {
String link = s.nextLine();
NetworkInterface ni = NetworkInterface.getByName(link);
if (ni != null) {
Enumeration addrs = ni.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = addrs.nextElement();
System.out.format(“Testing %s: %s\n“ link addr.getHostAddress());
test(addr);
}
}
}
} finally {
s.close();
}
}
static void test(InetAddress addr) throws Exception {
// Test SocketChannel and ServerSocketChannel
ServerSocketChannel ssc = Sdp.openServerSocketChannel();
try {
ssc.socket().bind(new InetSocketAddress(addr 0));
int port = ssc.socket().getLocalPort();
// SocketChannel.connect (implicit bind)
SocketChannel client = Sdp.openSocketChannel();
try {
client.connect(new InetSocketAddress(addr port));
SocketChannel peer = ssc.accept();
try {
testConnection(Channels.newOutputStream(client)
Channels.newInputStream(peer));
} finally {
peer.close();
}
} finally {
client.close();
}
// Socket
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-06-27 11:22 openjdk7\
文件 19263 2011-06-27 08:44 openjdk7\LICENSE
目录 0 2018-10-03 16:05 __MACOSX\
目录 0 2018-10-03 16:05 __MACOSX\openjdk7\
文件 212 2011-06-27 08:44 __MACOSX\openjdk7\._LICENSE
目录 0 2011-06-27 08:44 openjdk7\test\
文件 3062 2011-06-27 08:44 openjdk7\test\Makefile
目录 0 2018-10-03 16:05 __MACOSX\openjdk7\test\
文件 212 2011-06-27 08:44 __MACOSX\openjdk7\test\._Makefile
文件 212 2011-06-27 08:44 __MACOSX\openjdk7\._test
文件 16341 2011-06-27 08:44 openjdk7\Makefile
文件 212 2011-06-27 08:44 __MACOSX\openjdk7\._Makefile
目录 0 2011-06-27 11:35 openjdk7\jdk\
文件 19263 2011-06-27 10:18 openjdk7\jdk\LICENSE
目录 0 2018-10-03 16:05 __MACOSX\openjdk7\jdk\
文件 212 2011-06-27 10:18 __MACOSX\openjdk7\jdk\._LICENSE
目录 0 2011-06-27 11:10 openjdk7\jdk\test\
目录 0 2011-06-27 10:53 openjdk7\jdk\test\demo\
目录 0 2011-06-27 10:53 openjdk7\jdk\test\demo\zipfs\
文件 5802 2011-06-27 10:53 openjdk7\jdk\test\demo\zipfs\Basic.java
目录 0 2018-10-03 16:05 __MACOSX\openjdk7\jdk\test\
目录 0 2018-10-03 16:05 __MACOSX\openjdk7\jdk\test\demo\
目录 0 2018-10-03 16:05 __MACOSX\openjdk7\jdk\test\demo\zipfs\
文件 212 2011-06-27 10:53 __MACOSX\openjdk7\jdk\test\demo\zipfs\._Basic.java
文件 1939 2011-06-27 10:53 openjdk7\jdk\test\demo\zipfs\basic.sh
文件 212 2011-06-27 10:53 __MACOSX\openjdk7\jdk\test\demo\zipfs\._basic.sh
文件 11902 2011-06-27 10:53 openjdk7\jdk\test\demo\zipfs\PathOps.java
文件 212 2011-06-27 10:53 __MACOSX\openjdk7\jdk\test\demo\zipfs\._PathOps.java
文件 22868 2011-06-27 10:53 openjdk7\jdk\test\demo\zipfs\ZipFSTester.java
文件 212 2011-06-27 10:53 __MACOSX\openjdk7\jdk\test\demo\zipfs\._ZipFSTester.java
文件 212 2011-06-27 10:53 __MACOSX\openjdk7\jdk\test\demo\._zipfs
............此处省略7758个文件信息
相关资源
- mysql数据处理,java用户登录处理
- 法律咨询信息系统(java+jsp+sqlserver)
- Java快速开发平台源码(renren-fast)
- 锐聘学院QST青软JavaWeb十二个打包
- 3.3.6微信支付JAVA版demo
- javaweb网上购物系统源码(附数据库脚
- javaweb校园宿舍系统(附数据库脚本)
- JavaWeb书城项目(附数据库脚本)
- 基于JAVA_JSP电子书系统(源码+数据库
- Java网络编程知识点总结.xmind
- 一站式Java网络编程 BIO-NIO-AIO资料源码
- jsp讲解
- 基于SSH框架的JavaWeb项目—人员信息管
- javaweb实现的邮件收发系统(附数据库
- Java 仿QQ(附客户端以及服务端源码)
- Java TCP IP Socket
- java定时发送邮件(基于quartz)
- Java Swing开发的《星际争霸》游戏
- java+数据库商品交易管理系统(附数据
- 使用java语言编译一个计算器
- java swing工资管理系统(源码+数据库
- JAVALibrary
- 微信企业号回调模式Java版
- 顺丰丰桥接口开发详细教程源码含下
- Java博客概要设计文档
- 药品进销存管理系统(论文范文_JSP
- 奖学金管理系统java+jsp+mysql
- 毕设参考——基于java酒店管理
- Java写的一个简单的字体更改程序
- java8学习教程之lambda表达式的使用方法
评论
共有 条评论