由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Help: UnknownHostException
相关主题
getLocalHost() with multiple networkcard一个Java程序员的话(4)--续第一章
Re: How can I get localhost's address in a Applet?Can't figure out: why can't append again
how can I test own local IP address在线等,
Ask a simple question about throw exception, bow bow bowZT: 关于性爱的多线程问题研究(一)
question about install jdbcHelp! ClassCastException
how to get time(ms) in Java?Urgent!
non-GPL free/oss embeded object/xml database?ERROR!java.io.RandomAccessFile.readInt
关于对象向量删除/添加question about Exeption
相关话题的讨论汇总
话题: host话题: ip话题: returns
进入Java版参与讨论
1 (共1页)
u**********e
发帖数: 282
1
我在程序里用到java.net.InetAddress.getLocalHost(),
却catch到UnknownHostException。
请问什么状况下有可能发生?有没有work around? 谢谢
m******t
发帖数: 2416
2

RTFM:
getLocalHost
public static InetAddress getLocalHost() throws UnknownHostException
Returns the local host.
If there is a security manager, its checkConnect method is called with the
local host name and -1 as its arguments to see if the operation is allowed. If
the operation is not allowed, an InetAddress representing the loopback address
is returned.
Returns:
the IP address of the local host.
Throws:
UnknownHostException - if no IP address for the host could be found.
See Also:
SecurityMan

【在 u**********e 的大作中提到】
: 我在程序里用到java.net.InetAddress.getLocalHost(),
: 却catch到UnknownHostException。
: 请问什么状况下有可能发生?有没有work around? 谢谢

1 (共1页)
进入Java版参与讨论
相关主题
question about Exeptionquestion about install jdbc
BufferedWriter里的write()how to get time(ms) in Java?
关于char和int的问题non-GPL free/oss embeded object/xml database?
A question on easyMock2关于对象向量删除/添加
getLocalHost() with multiple networkcard一个Java程序员的话(4)--续第一章
Re: How can I get localhost's address in a Applet?Can't figure out: why can't append again
how can I test own local IP address在线等,
Ask a simple question about throw exception, bow bow bowZT: 关于性爱的多线程问题研究(一)
相关话题的讨论汇总
话题: host话题: ip话题: returns