首页 > 编程语言 > 详细

Java网络编程(InetAddress)

时间:2014-08-15 17:52:39      阅读:364      评论:0      收藏:0      [点我收藏+]
package org.InetAddressDemo;


import java.net.InetAddress;


public class InetAddressDemo {
public static void main(String[] args) throws Exception{
InetAddress locAdd = null;
InetAddress remAdd = null;
locAdd = InetAddress.getLocalHost();
remAdd = InetAddress.getByName("www.hut.edu.cn");
System.out.println("本机IP地址:"+locAdd.getHostAddress());
System.out.println("hut的IP地址:"+remAdd.getHostAddress());
System.out.println("本机是否可达到:"+locAdd.isReachable(5000));
}
}

Java网络编程(InetAddress),布布扣,bubuko.com

Java网络编程(InetAddress)

原文:http://blog.csdn.net/u012927417/article/details/38587761

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!