JavaTM 2 Platform
Standard Ed. 6

类 java.net.UnknownHostException
的使用

使用 UnknownHostException 的软件包
java.net 为实现网络应用程序提供类。 
javax.net 提供用于网络应用程序的类。 
javax.net.ssl 提供用于安全套接字包的类。 
 

java.netUnknownHostException 的使用
 

抛出 UnknownHostExceptionjava.net 中的方法
static InetAddress[] InetAddress.getAllByName(String host)
          在给定主机名的情况下,根据系统上配置的名称服务返回其 IP 地址所组成的数组。
static InetAddress InetAddress.getByAddress(byte[] addr)
          在给定原始 IP 地址的情况下,返回 InetAddress 对象。
static InetAddress InetAddress.getByAddress(String host, byte[] addr)
          根据提供的主机名和 IP 地址创建 InetAddress。
static Inet6Address Inet6Address.getByAddress(String host, byte[] addr, int scope_id)
          完全按照 InetAddress.getByAddress(String,byte[]) 的方式创建 Inet6Address,唯一的不同是将 IPv6 scope_id 设置为给定的数字值。
static Inet6Address Inet6Address.getByAddress(String host, byte[] addr, NetworkInterface nif)
          完全按照 InetAddress.getByAddress(String,byte[]) 的方式创建 Inet6Address,唯一的不同是将 IPv6 scope_id 设置为与在 addr 中指定地址类型的给定接口相对应的值。
static InetAddress InetAddress.getByName(String host)
          在给定主机名的情况下确定主机的 IP 地址。
static InetAddress InetAddress.getLocalHost()
          返回本地主机。
 

抛出 UnknownHostExceptionjava.net 中的构造方法
Socket(String host, int port)
          创建一个流套接字并将其连接到指定主机上的指定端口号。
 

javax.netUnknownHostException 的使用
 

抛出 UnknownHostExceptionjavax.net 中的方法
abstract  Socket SocketFactory.createSocket(String host, int port)
          创建一个套接字并把它连接到指定远程主机上的指定远程端口。
abstract  Socket SocketFactory.createSocket(String host, int port, InetAddress localHost, int localPort)
          创建一个套接字并把它连接到指定远程主机上的指定远程端口。
 

javax.net.sslUnknownHostException 的使用
 

抛出 UnknownHostExceptionjavax.net.ssl 中的构造方法
SSLSocket(String host, int port)
          仅供子类使用。
SSLSocket(String host, int port, InetAddress clientAddress, int clientPort)
          仅供子类使用。
 


JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only