|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.endpoint.IPUtils
public final class IPUtils
Utility methods for use by IP based transports.
Field Summary | |
---|---|
static InetAddress |
ANYADDRESS
Constant which works as the IP "Any Address" value |
static InetAddress |
ANYADDRESSV4
|
static InetAddress |
ANYADDRESSV6
|
(package private) static String |
IPV4ANYADDRESS
|
(package private) static String |
IPV4LOOPBACK
|
(package private) static String |
IPV6ANYADDRESS
|
(package private) static String |
IPV6LOOPBACK
|
static InetAddress |
LOOPBACK
Constant which works as the IP "Local Loopback" value; |
static InetAddress |
LOOPBACKV4
|
static InetAddress |
LOOPBACKV6
|
(package private) static Random |
random
|
(package private) static int |
rangesize
Size of port groups we will probe. |
Method Summary | |
---|---|
static Socket |
connectToFrom(InetAddress inetAddress,
int port,
InetAddress usingInterface,
int localPort,
int timeout)
Create a client socket using the configured socketFactory or connectToFromNoFactory if none is available. |
static Socket |
connectToFromNoFactory(InetAddress inetAddress,
int port,
InetAddress usingInterface,
int localPort,
int timeout)
Create a client socket with the JDK1.4 method connect(). |
static Iterator<InetAddress> |
getAllLocalAddresses()
Provide an iterator which returns all of the local InetAddresses for this host. |
static String |
getHostAddress(InetAddress anAddress)
Normalized version of InetAddress.getHostAddress() that
handles IPv6 addresss formatting using the style of IETF RFC 2732 and
also handles removal of IPv6 scoping identifiers. |
static ServerSocketFactory |
getServerSocketFactory()
returns the ServerSocketFactory to create server sockets, or null if new SeverSocket() is being used. |
static SocketFactory |
getSocketFactory()
returns the socketFactory used by connectToFrom() to create sockets, or null if connectToFromNoFactory() is being used. |
static ServerSocket |
openServerSocketInRange(int start,
int end,
int backlog,
InetAddress bindAddress)
Open a ServerSocket in the specified range. |
static InetSocketAddress |
parseSocketAddress(String anAddress)
Parses a String containing a SokectAddress formatted as either: <host> ":" <port> "[" <numeric_host> "]:" <port> |
static void |
setServerSocketFactory(ServerSocketFactory sf)
makes connectToFrom create sockets with this factory. |
static void |
setSocketFactory(SocketFactory sf)
makes connectToFrom create sockets with this factory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final Random random
static final String IPV4ANYADDRESS
static final String IPV6ANYADDRESS
static final String IPV4LOOPBACK
static final String IPV6LOOPBACK
public static final InetAddress ANYADDRESS
public static final InetAddress ANYADDRESSV4
public static final InetAddress ANYADDRESSV6
public static final InetAddress LOOPBACK
public static final InetAddress LOOPBACKV4
public static final InetAddress LOOPBACKV6
static final int rangesize
Method Detail |
---|
public static Iterator<InetAddress> getAllLocalAddresses()
public static String getHostAddress(InetAddress anAddress)
InetAddress.getHostAddress()
that
handles IPv6 addresss formatting using the style of IETF RFC 2732 and
also handles removal of IPv6 scoping identifiers.
anAddress
- The address to format as a String.
public static InetSocketAddress parseSocketAddress(String anAddress)
<host> ":" <port> "[" <numeric_host> "]:" <port>
anAddress
- The address string to be parsed.
public static Socket connectToFrom(InetAddress inetAddress, int port, InetAddress usingInterface, int localPort, int timeout) throws IOException
inetAddress
- Destination addressport
- Destination portusingInterface
- Interface to uselocalPort
- local porttimeout
- timeout in millis
IOException
- if an io error occurspublic static Socket connectToFromNoFactory(InetAddress inetAddress, int port, InetAddress usingInterface, int localPort, int timeout) throws IOException
inetAddress
- Destination addressport
- Destination portusingInterface
- Interface to uselocalPort
- local porttimeout
- timeout in millis
IOException
- if an io error occurspublic static void setSocketFactory(SocketFactory sf)
sf
- is the socket factory to use or null if you want the
default behaviour provided by connectToFromNoFactory().public static SocketFactory getSocketFactory()
public static void setServerSocketFactory(ServerSocketFactory sf)
sf
- is the socket factory to use or null if you want the
default behaviour provided by new SeverSocket().public static ServerSocketFactory getServerSocketFactory()
public static ServerSocket openServerSocketInRange(int start, int end, int backlog, InetAddress bindAddress) throws IOException
start
- The lowest numbered port to try.end
- The highest numbered port to try.backlog
- the allowed backlog of unaccepted connections.bindAddress
- the InetAddress to which to bind.
IOException
- when the socket cannot be opened. (Lame, but that's what ServerSocket says).
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |