java.lang.Object
javax.net.SocketFactory
org.jnp.interfaces.TimedSocketFactory
- public class TimedSocketFactory
- extends javax.net.SocketFactory
A concrete implementation of the SocketFactory that supports a configurable
timeout for the initial socket connection as well as the SO_TIMEOUT used to
determine how long a read will block waiting for data.
- Version:
- $Revision: 1.2 $
|
Nested Class Summary |
(package private) class |
TimedSocketFactory.ConnectThread
A subclass of Thread used to time the blocking connect operation
and notify the thread attempting the socket connect of a timeout. |
|
Method Summary |
java.net.Socket |
createSocket(java.net.InetAddress hostAddr,
int port)
Creates a socket connected to a given host on a given port. |
java.net.Socket |
createSocket(java.net.InetAddress hostAddr,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates a socket connected to a given host on a given port,
connecting locally to the interface with the given address and port. |
protected java.net.Socket |
createSocket(java.net.InetAddress hostAddr,
int port,
java.net.InetAddress localAddr,
int localPort,
int connectTimeout)
|
java.net.Socket |
createSocket(java.lang.String host,
int port)
Creates a socket connected to a given host on a given port. |
java.net.Socket |
createSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
Creates a socket connected to a given host on a given port,
connecting locally to the interface with the given address and port. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JNP_TIMEOUT
public static final java.lang.String JNP_TIMEOUT
- See Also:
- Constant Field Values
JNP_SO_TIMEOUT
public static final java.lang.String JNP_SO_TIMEOUT
- See Also:
- Constant Field Values
timeout
protected int timeout
- The connection timeout in milliseconds
soTimeout
protected int soTimeout
- The SO_TIMEOUT in milliseconds
TimedSocketFactory
public TimedSocketFactory()
- Creates a new instance of TimedSocketFactory
TimedSocketFactory
public TimedSocketFactory(java.util.Hashtable env)
createSocket
public java.net.Socket createSocket(java.lang.String host,
int port)
throws java.io.IOException,
java.net.UnknownHostException
- Description copied from class:
javax.net.SocketFactory
- Creates a socket connected to a given host on a given port.
createSocket
public java.net.Socket createSocket(java.net.InetAddress hostAddr,
int port)
throws java.io.IOException
- Description copied from class:
javax.net.SocketFactory
- Creates a socket connected to a given host on a given port.
createSocket
public java.net.Socket createSocket(java.lang.String host,
int port,
java.net.InetAddress localAddr,
int localPort)
throws java.io.IOException,
java.net.UnknownHostException
- Description copied from class:
javax.net.SocketFactory
- Creates a socket connected to a given host on a given port,
connecting locally to the interface with the given address and port.
createSocket
public java.net.Socket createSocket(java.net.InetAddress hostAddr,
int port,
java.net.InetAddress localAddr,
int localPort)
throws java.io.IOException
- Description copied from class:
javax.net.SocketFactory
- Creates a socket connected to a given host on a given port,
connecting locally to the interface with the given address and port.
createSocket
protected java.net.Socket createSocket(java.net.InetAddress hostAddr,
int port,
java.net.InetAddress localAddr,
int localPort,
int connectTimeout)
throws java.io.IOException