|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.net.SocketAddress
org.p2psockets.P2PSocketAddress
This class implements a P2P Socket Address (Jxta host name + port number + IP Address).
Constructor Summary | |
P2PSocketAddress(java.net.InetAddress inetAddr,
int port)
Creates a socket address from an IP address and a port number. |
|
P2PSocketAddress(int port)
Creates a socket address where the IP address is the wildcard address and the port number a specified value. |
|
P2PSocketAddress(java.lang.String host,
int port)
Creates a socket address from a host and a port number. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
|
protected int |
generateRandomPort()
This method generates a random port number. |
java.net.InetAddress |
getAddress()
Gets the InetAddress . |
java.lang.String |
getHostName()
Gets the host . |
int |
getPort()
Gets the port number. |
int |
hashCode()
|
void |
setHostName(java.lang.String host)
|
void |
setPort(int port)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public P2PSocketAddress(int port)
A valid port value is between 0 and 65535.
A port number of zero
will let the system pick up an
ephemeral port in a bind
operation.
port
- The port number
java.lang.IllegalArgumentException
- if the port parameter is outside the specified
range of valid port values.public P2PSocketAddress(java.net.InetAddress inetAddr, int port)
A valid port value is between 0 and 65535.
A port number of zero
will let the system pick up an
ephemeral port in a bind
operation.
A null
address will assign the wildcard address.
inetAddr
- The IP addressport
- The port number
java.lang.IllegalArgumentException
- if the port parameter is outside the specified
range of valid port values.public P2PSocketAddress(java.lang.String host, int port)
An attempt will be made to resolve the host into an InetAddress. If that attempt fails, the address will be flagged as unresolved.
A valid port value is between 0 and 65535.
A port number of zero
will let the system pick up an
ephemeral port in a bind
operation.
host
- the Host nameport
- The port number
java.lang.IllegalArgumentException
- if the port parameter is outside the range
of valid port values, or if the host parameter is null.#isUnresolved()
Method Detail |
public final int getPort()
public final java.net.InetAddress getAddress()
InetAddress
.
null
if it is unresolved.public final java.lang.String getHostName()
host
.
public void setPort(int port)
public void setHostName(java.lang.String host)
public java.lang.String toString()
public final boolean equals(java.lang.Object obj)
public final int hashCode()
protected int generateRandomPort()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |