不好意思,错了,是取ip地址?
解决方案 »
- 关于HQL查询 请高手来,深夜急问
- java.lang.NumberFormatException: null 错误
- 请教,如何用out.print(),输出<%@ include file="XXX" %>语句,转义字符的问题!
- 请教一个<jsp:useBean ...>在tomcat4和tomcat5中存在诧异的问题.
- 奇怪啊!急
- jsp中怎么控制输出?
- 不知道问题出在哪里?在jsp里没有错误的,但是在java application却总是出现错误。请指点一下!
- JSP和XML共同使用字符集问题
- oracle数据迁移
- Junit测试ssm中Controller的问题
- 搞不定就要走人啊
- 请问如何防止表单的重复提交?
import java.net.*;
public class NetTool{
InetAddress myIPaddress=null;
InetAddress myServer=null;public static void main( String args[]){NetTool mytool;
mytool=new NetTool();System.out.println("Your host IP is: "
+ mytool.getMyIP());
System.out.println("The Server IP is :"
+mytool.getServerIP());}//取得LOCALHOST的IP地址
public InetAddress getMyIP() {
try { myIPaddress=InetAddress.getLocalHost();}
catch (UnknownHostException e) {}
return (myIPaddress);
}
//取得 www.abc.com 的IP地址
public InetAddress getServerIP(){
try {myServer=InetAddress.getByName(
"www.abc.com");}
catch (UnknownHostException e) {}
return (myServer);
}}看看这个呢!?