|
WebObjects 5.2.3 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.webobjects.foundation.NSSocketUtilities
This class provides an easy way to get a TCP socket (java.net.Socket
) with a connection
timeout. The static methods in this class correspond to all of the
java.net.Socket
constructors.
Invoking getSocketWithTimeout
either returns a valid socket, or throws an
IOException (because the Socket creation timed out, or failed for other reasons). When a
new socket is requested with getSocketWithTimeout
,
a timeout argument (in milliseconds) is passed in, and the socket
creation times-out when that timeout is exceeded. Passing a timeout value of 0 will result in
the default java.net.Socket
creation behavior (i.e. a system dependant timeout).
This class only contains static methods, and should never be instantiated.
getSocketWithTimeout(String host, int port, int timeout)
,
getSocketWithTimeout(InetAddress address, int port, int timeout)
,
getSocketWithTimeout(String host, int port, InetAddress localAddress, int localPort, int timeout)
,
getSocketWithTimeout(InetAddress address, int port, InetAddress localAddress, int localPort, int timeout)
,
Socket
Constructor Summary | |
NSSocketUtilities()
|
Method Summary | |
static Socket |
getSocketWithTimeout(InetAddress address,
int port,
InetAddress localAddress,
int localPort,
int timeout)
Creates a socket and connects it to the remote address and host specified, using
the given timeout in milliseconds. |
static Socket |
getSocketWithTimeout(InetAddress address,
int port,
int timeout)
Creates a socket and connects it to the remote port and address specified,
using the given timeout in milliseconds. |
static Socket |
getSocketWithTimeout(String host,
int port,
InetAddress localAddress,
int localPort,
int timeout)
Creates a socket and connects it to the remote port and host specified, using
the given timeout in milliseconds. |
static Socket |
getSocketWithTimeout(String host,
int port,
int timeout)
Creates a socket and connects it to the remote port and host specified,
using the given timeout in milliseconds. |
static int |
pollingInterval()
Deprecated. This method always returns 0. |
static void |
setPollingInterval(int interval)
Deprecated. This method no longer does anything, and should not be used. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NSSocketUtilities()
Method Detail |
public static Socket getSocketWithTimeout(String host, int port, int timeout) throws UnknownHostException, IOException
port
and host
specified,
using the given timeout
in milliseconds.
host
- specifies the remote host name or IPport
- specifies the remote porttimeout
- specifies the connection timeout in milliseconds
host:port
UnknownHostException
- host
cannot be resolved
IOException
- the socket can't be createdpublic static Socket getSocketWithTimeout(String host, int port, InetAddress localAddress, int localPort, int timeout) throws UnknownHostException, IOException
port
and host
specified, using
the given timeout
in milliseconds. The local end of the socket will be bound to
the localPort
and localAddress
specified.
host
- specifies the remote host name or IPport
- specifies the remote portlocalAddress
- specifies the local addresslocalPort
- specifies the local porttimeout
- specifies the connection timeout in milliseconds
host:port
remotely and to localAddress:localPort
locally
UnknownHostException
- host
cannot be resolved
IOException
- the socket can't be createdpublic static Socket getSocketWithTimeout(InetAddress address, int port, int timeout) throws IOException
port
and address
specified,
using the given timeout
in milliseconds.
address
- specifies the remote host addressport
- specifies the remote porttimeout
- specifies the connection timeout in milliseconds
address:port
IOException
- the socket can't be createdpublic static Socket getSocketWithTimeout(InetAddress address, int port, InetAddress localAddress, int localPort, int timeout) throws IOException
address
and host
specified, using
the given timeout in milliseconds. The local end of the socket will be bound to
the localPort
and localAddress
specified.
address
- specifies the remote host addressport
- specifies the remote portlocalAddress
- specifies the local addresslocalPort
- specifies the local porttimeout
- specifies the connection timeout in milliseconds
address:port
remotely and localAddress:localPort
locally
UnknownHostException
- host
cannot be resolved
IOException
- the socket can't be createdpublic static int pollingInterval()
public static void setPollingInterval(int interval)
|
Last updated Thu Oct 21 15:04:16 PDT 2004. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |