分享
 
 
 

java.net.InetSocketAddress翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!--NewPage-->

<HTML>

<HEAD>

<!-- Generated by javadoc (build 1.4.2-rc) on Fri Jun 13 00:14:24 PDT 2003 -->

<TITLE>

InetSocketAddress (Java 2 Platform SE v1.4.2)

</TITLE>

<META NAME="keywords" CONTENT="java.net.InetSocketAddress class">

<META NAME="keywords" CONTENT="getPort()">

<META NAME="keywords" CONTENT="getAddress()">

<META NAME="keywords" CONTENT="getHostName()">

<META NAME="keywords" CONTENT="isUnresolved()">

<META NAME="keywords" CONTENT="toString()">

<META NAME="keywords" CONTENT="equals()">

<META NAME="keywords" CONTENT="hashCode()">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">

function windowTitle()

{

parent.document.title="InetSocketAddress (Java 2 Platform SE v1.4.2)";

}

</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">

<!-- ========= START OF TOP NAVBAR ======= -->

<A NAME="navbar_top"><!-- --></A>

<A HREF="#skip-navbar_top" title="Skip navigation links"></A>

<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">

<TR>

<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">

<A NAME="navbar_top_firstrow"><!-- --></A>

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">

<TR ALIGN="center" VALIGN="top">

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/InetSocketAddress.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>

</TR>

</TABLE>

</TD>

<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>

<b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.4.2</b></EM>

</TD>

</TR>

<TR>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

&nbsp;<A HREF="../../java/net/InetAddress.html" title="class in java.net"><B>PREV CLASS</B></A>&nbsp;

&nbsp;<A HREF="../../java/net/JarURLConnection.html" title="class in java.net"><B>NEXT CLASS</B></A></FONT></TD>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

<A HREF="../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;

&nbsp;<A HREF="InetSocketAddress.html" target="_top"><B>NO FRAMES</B></A> &nbsp;

&nbsp;<SCRIPT type="text/javascript">

<!--

if(window==top) {

document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');

}

//-->

</SCRIPT>

<NOSCRIPT>

<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>

</NOSCRIPT>

</FONT></TD>

</TR>

<TR>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>

</TR>

</TABLE>

<A NAME="skip-navbar_top"></A>

<!-- ========= END OF TOP NAVBAR ========= -->

<HR>

<!-- ======== START OF CLASS DATA ======== -->

<H2>

<FONT SIZE="-1">

java.net</FONT>

<BR>

Class InetSocketAddress</H2>

<PRE>

<A HREF="../../java/lang/Object.html" title="class in java.lang">java.lang.Object</A>

<IMG SRC="../../resources/inherit.gif" ALT="extended by"><A HREF="../../java/net/SocketAddress.html" title="class in java.net">java.net.SocketAddress</A>

<IMG SRC="../../resources/inherit.gif" ALT="extended by"><B>java.net.InetSocketAddress</B>

</PRE>

<DL>

<DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/io/Serializable.html" title="interface in java.io">Serializable</A></DD>

</DL>

<HR>

<DL>

<DT>public class <B>InetSocketAddress</B><DT>extends <A HREF="../../java/net/SocketAddress.html" title="class in java.net">SocketAddress</A></DL>

<P>

This class implements an IP Socket Address (IP address + port number)

It can also be a pair (hostname + port number), in which case an attempt

will be made to resolve the hostname. If resolution fails then the address

is said to be <I>unresolved</I> but can still be used on some circumstances

like connecting through a proxy.

该类实现了IP套接字地址(IP地址+端口号),也可以是主机号+端口号,这种情况将尝试解析主机名。

如果解析失败则称地址unresolved,但在有些情况下仍然可用例如通过代理服务器的连接。。

<p>

It provides an immutable object used by sockets for binding, connecting, or

as returned values.

其提供了一种不变的对象,用于套接字的绑定、连接,或作为返回值。

<p>

The <i>wildcard</i> is a special local IP address. It usually means "any"

and can only be used for <code>bind</code> operations.

掩码是一种特殊的IP地址。它通常意味着“任意”,只能用于绑定操作。

<P>

<P>

<DL>

<DT><B>Since:</B></DT>

<DD>1.4</DD>

<DT><B>See Also:</B><DD><A HREF="../../java/net/Socket.html" title="class in java.net"><CODE>Socket</CODE></A>,

<A HREF="../../java/net/ServerSocket.html" title="class in java.net"><CODE>ServerSocket</CODE></A>,

<A HREF="../../serialized-form.html#java.net.InetSocketAddress">Serialized Form</A></DL>

<HR>

<P>

<!-- ======== NESTED CLASS SUMMARY ======== -->

<!-- =========== FIELD SUMMARY =========== -->

<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

<TD COLSPAN=2><FONT SIZE="+2">

<B>Constructor Summary</B></FONT></TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#InetSocketAddress(java.net.InetAddress, int)">InetSocketAddress</A></B>(<A HREF="../../java/net/InetAddress.html" title="class in java.net">InetAddress</A>&nbsp;addr,

int&nbsp;port)</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a socket address from an IP address and a port number.

根据IP地址和端口号创建一个套接字地址。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#InetSocketAddress(int)">InetSocketAddress</A></B>(int&nbsp;port)</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a socket address where the IP address is the wildcard address

and the port number a specified value.

创建一个套接字地址,其IP地址为掩码地址,端口号为指定值。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#InetSocketAddress(java.lang.String, int)">InetSocketAddress</A></B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;hostname,

int&nbsp;port)</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a socket address from a hostname and a port number.

根据主机名和端口号创建一个套接字地址。</TD>

</TR>

</TABLE>

&nbsp;

<!-- ========== METHOD SUMMARY =========== -->

<A NAME="method_summary"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

<TD COLSPAN=2><FONT SIZE="+2">

<B>Method Summary</B></FONT></TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;boolean</CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#equals(java.lang.Object)">equals</A></B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>&nbsp;obj)</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Compares this object against the specified object.

将该对象同指定的对象进行比较。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;<A HREF="../../java/net/InetAddress.html" title="class in java.net">InetAddress</A></CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#getAddress()">getAddress</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>InetAddress</code>.

获得InetAddress对象。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;<A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#getHostName()">getHostName</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the <code>hostname</code>.

获得主机名。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;int</CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#getPort()">getPort</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gets the port number.

获得端口号。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;int</CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#hashCode()">hashCode</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a hashcode for this socket address.

返回该套接字地址的hash码。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;boolean</CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#isUnresolved()">isUnresolved</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Checks wether the address has been resolved or not.

检查此地址是否已被解析。</TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">

<CODE>&nbsp;<A HREF="../../java/lang/String.html" title="class in java.lang">String</A></CODE></FONT></TD>

<TD><CODE><B><A HREF="../../java/net/InetSocketAddress.html#toString()">toString</A></B>()</CODE>

<BR>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a string representation of this InetSocketAddress.

构造此InetSocketAddress的字符串形式。</TD>

</TR>

</TABLE>

&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">

<TD><B>Methods inherited from class java.lang.<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></B></TD>

</TR>

<TR BGCOLOR="white" CLASS="TableRowColor">

<TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD>

</TR>

</TABLE>

&nbsp;

<P>

<!-- ============ FIELD DETAIL =========== -->

<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

<TD COLSPAN=1><FONT SIZE="+2">

<B>Constructor Detail</B></FONT></TD>

</TR>

</TABLE>

<A NAME="InetSocketAddress(int)"><!-- --></A><H3>

InetSocketAddress</H3>

<PRE>

public <B>InetSocketAddress</B>(int&nbsp;port)</PRE>

<DL>

<DD>Creates a socket address where the IP address is the wildcard address

and the port number a specified value.

创建一个套接字地址,其IP地址为掩码地址,端口号为指定值。

<p>

A valid port value is between 0 and 65535.

A port number of <code>zero</code> will let the system pick up an

ephemeral port in a <code>bind</code> operation.

有效的端口号在0-65535之间。端口号为0意味着系统在绑定操作时选择一个临时端口。

<p>

<P>

<DT><B>Parameters:</B><DD><CODE>port</CODE> - The port number 端口号

<DT><B>Throws:</B>

<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the port parameter is outside the specified

range of valid port values. 如果端口号超出指定的有效端口值范围时抛出。</DL>

<HR>

<A NAME="InetSocketAddress(java.net.InetAddress, int)"><!-- --></A><H3>

InetSocketAddress</H3>

<PRE>

public <B>InetSocketAddress</B>(<A HREF="../../java/net/InetAddress.html" title="class in java.net">InetAddress</A>&nbsp;addr,

int&nbsp;port)</PRE>

<DL>

<DD>Creates a socket address from an IP address and a port number.

根据IP地址和端口号创建一个套接字地址。

<p>

A valid port value is between 0 and 65535.

A port number of <code>zero</code> will let the system pick up an

ephemeral port in a <code>bind</code> operation.

有效的端口号在0-65535之间。端口号为0意味着系统在绑定操作时选择一个临时端口。

<P>

A <code>null</code> address will assign the <i>wildcard</i> address.

null地址将指定为掩码地址。

<p>

<P>

<DT><B>Parameters:</B><DD><CODE>addr</CODE> - The IP address IP地址<DD><CODE>port</CODE> - The port number 端口号

<DT><B>Throws:</B>

<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the port parameter is outside the specified

range of valid port values.

如果端口号超出指定的有效端口值范围时抛出。</DL>

<HR>

<A NAME="InetSocketAddress(java.lang.String, int)"><!-- --></A><H3>

InetSocketAddress</H3>

<PRE>

public <B>InetSocketAddress</B>(<A HREF="../../java/lang/String.html" title="class in java.lang">String</A>&nbsp;hostname,

int&nbsp;port)</PRE>

<DL>

<DD>Creates a socket address from a hostname and a port number.

根据主机名和端口号创建一个套接字地址。

<p>

An attempt will be made to resolve the hostname into an InetAddress.

If that attempt fails, the address will be flagged as <I>unresolved</I>.

尝试将主机名解析为IP地址。如果尝试失败,用unresolved标识地址。

<p>

A valid port value is between 0 and 65535.

A port number of <code>zero</code> will let the system pick up an

ephemeral port in a <code>bind</code> operation.

有效的端口号在0-65535之间。端口号为0意味着系统在绑定操作时选择一个临时端口。

<P>

<P>

<DT><B>Parameters:</B><DD><CODE>hostname</CODE> - the Host name 主机名<DD><CODE>port</CODE> - The port number 端口号

<DT><B>Throws:</B>

<DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html" title="class in java.lang">IllegalArgumentException</A></CODE> - if the port parameter is outside the range

of valid port values, or if the hostname parameter is <TT>null</TT>.

如果端口号超出指定的有效端口值范围或者主机名参数为null时抛出。<DT><B>See Also:</B><DD><A HREF="../../java/net/InetSocketAddress.html#isUnresolved()"><CODE>isUnresolved()</CODE></A></DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>

<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">

<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">

<TD COLSPAN=1><FONT SIZE="+2">

<B>Method Detail</B></FONT></TD>

</TR>

</TABLE>

<A NAME="getPort()"><!-- --></A><H3>

getPort</H3>

<PRE>

public final int <B>getPort</B>()</PRE>

<DL>

<DD>Gets the port number. 获得端口号。

<P>

<DD><DL>

<DT><B>Returns:</B><DD>the port number. 端口号。</DL>

</DD>

</DL>

<HR>

<A NAME="getAddress()"><!-- --></A><H3>

getAddress</H3>

<PRE>

public final <A HREF="../../java/net/InetAddress.html" title="class in java.net">InetAddress</A> <B>getAddress</B>()</PRE>

<DL>

<DD>Gets the <code>InetAddress</code>. 获得InetAddress对象。

<P>

<DD><DL>

<DT><B>Returns:</B><DD>the InetAdress or <code>null</code> if it is unresolved. 返回InetAdress,如果不能解析,则为null。</DL>

</DD>

</DL>

<HR>

<A NAME="getHostName()"><!-- --></A><H3>

getHostName</H3>

<PRE>

public final <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>getHostName</B>()</PRE>

<DL>

<DD>Gets the <code>hostname</code>. 获得主机名。

<P>

<DD><DL>

<DT><B>Returns:</B><DD>the hostname part of the address. 地址的主机名部分。</DL>

</DD>

</DL>

<HR>

<A NAME="isUnresolved()"><!-- --></A><H3>

isUnresolved</H3>

<PRE>

public final boolean <B>isUnresolved</B>()</PRE>

<DL>

<DD>Checks wether the address has been resolved or not. 检查此地址是否已被解析。

<P>

<DD><DL>

<DT><B>Returns:</B><DD><code>true</code> if the hostname couldn't be resolved into

an <code>InetAddress</code>. 如果主机名不能解析为IP地址,返回true。</DL>

</DD>

</DL>

<HR>

<A NAME="toString()"><!-- --></A><H3>

toString</H3>

<PRE>

public <A HREF="../../java/lang/String.html" title="class in java.lang">String</A> <B>toString</B>()</PRE>

<DL>

<DD>Constructs a string representation of this InetSocketAddress.

This String is constructed by calling toString() on the InetAddress

and concatenating the port number (with a colon). If the address

is unresolved then the part before the colon will only contain the hostname.

构造此InetSocketAddress的字符串形式。调用toString()构造的字符串为IP地址和以冒号连接端口号。

如果不能解析主机名,则冒号前的部分将只包含主机名。

<P>

<DD><DL>

<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>

</DD>

<DD><DL>

<DT><B>Returns:</B><DD>a string representation of this object. 该对象的字符串形式。</DL>

</DD>

</DL>

<HR>

<A NAME="equals(java.lang.Object)"><!-- --></A><H3>

equals</H3>

<PRE>

public final boolean <B>equals</B>(<A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A>&nbsp;obj)</PRE>

<DL>

<DD>Compares this object against the specified object.

The result is <code>true</code> if and only if the argument is

not <code>null</code> and it represents the same address as

this object.

将该对象同指定的对象进行比较。只有参数不为null且同此对象表示相同的地址时结果为true。

<p>

Two instances of <code>InetSocketAddress</code> represent the same

address if both the InetAddresses (or hostnames if it is unresolved) and port

numbers are equal.

If both addresses are unresolved, then the hostname & the port number

are compared.

如果InetAddresses(如果未解析可为主机名)和端口号相同, 则两个InetAddresses的实例表示相同的地址。

如果两者的地址都不能解析,则比较主机名和端口号。

<P>

<DD><DL>

<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>

</DD>

<DD><DL>

<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the object to compare against. 要比较的对象。

<DT><B>Returns:</B><DD><code>true</code> if the objects are the same;

<code>false</code> otherwise.

如果对象相同,返回true,否则为false。<DT><B>See Also:</B><DD><A HREF="../../java/net/InetAddress.html#equals(java.lang.Object)"><CODE>InetAddress.equals(java.lang.Object)</CODE></A></DL>

</DD>

</DL>

<HR>

<A NAME="hashCode()"><!-- --></A><H3>

hashCode</H3>

<PRE>

public final int <B>hashCode</B>()</PRE>

<DL>

<DD>Returns a hashcode for this socket address. 返回该套接字地址的hash码。

<P>

<DD><DL>

<DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#hashCode()">hashCode</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html" title="class in java.lang">Object</A></CODE></DL>

</DD>

<DD><DL>

<DT><B>Returns:</B><DD>a hash code value for this socket address. 该套接字地址的hash码值。<DT><B>See Also:</B><DD><A HREF="../../java/lang/Object.html#equals(java.lang.Object)"><CODE>Object.equals(java.lang.Object)</CODE></A>,

<A HREF="../../java/util/Hashtable.html" title="class in java.util"><CODE>Hashtable</CODE></A></DL>

</DD>

</DL>

<!-- ========= END OF CLASS DATA ========= -->

<HR>

<!-- ======= START OF BOTTOM NAVBAR ====== -->

<A NAME="navbar_bottom"><!-- --></A>

<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>

<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">

<TR>

<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">

<A NAME="navbar_bottom_firstrow"><!-- --></A>

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">

<TR ALIGN="center" VALIGN="top">

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/InetSocketAddress.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>

<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>

</TR>

</TABLE>

</TD>

<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>

<b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.4.2</b></EM>

</TD>

</TR>

<TR>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

&nbsp;<A HREF="../../java/net/InetAddress.html" title="class in java.net"><B>PREV CLASS</B></A>&nbsp;

&nbsp;<A HREF="../../java/net/JarURLConnection.html" title="class in java.net"><B>NEXT CLASS</B></A></FONT></TD>

<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">

<A HREF="../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;

&nbsp;<A HREF="InetSocketAddress.html" target="_top"><B>NO FRAMES</B></A> &nbsp;

&nbsp;<SCRIPT type="text/javascript">

<!--

if(window==top) {

document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>');

}

//-->

</SCRIPT>

<NOSCRIPT>

<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>

</NOSCRIPT>

</FONT></TD>

</TR>

<TR>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>

<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">

DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>

</TR>

</TABLE>

<A NAME="skip-navbar_bottom"></A>

<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>

<font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="../../../relnotes/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to <a href="../../../relnotes/license.html">license terms</a>. Also see the <a href="http://java.sun.com/docs/redist.html">documentation redistribution policy</a>.</font>

</BODY>

</HTML>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有