|
WebObjects 5.4.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webobjects.foundation.NSSocketUtilities
public class 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 java.io.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.
NSSocketUtilities.getSocketWithTimeout(String host, int port, int timeout)
,
NSSocketUtilities.getSocketWithTimeout(InetAddress address, int port, int timeout)
,
NSSocketUtilities.getSocketWithTimeout(String host, int port, InetAddress localAddress, int localPort, int timeout)
,
NSSocketUtilities.getSocketWithTimeout(InetAddress address, int port, InetAddress localAddress, int localPort, int timeout)
,
Socket
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 |
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 created@Deprecated public static int pollingInterval()
@Deprecated public static void setPollingInterval(int interval)
|
Last updated June 2008 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |