com.ibm.gcs.netutil
Class SocketFactory
java.lang.Object
|
+--com.ibm.gcs.netutil.SocketFactory
- public class SocketFactory
- extends java.lang.Object
SocketFactory makes sockets, and times out if it takes
too long to connect when making the socket.
It is based on an article written by David Reilly, for JavaWorld:
"http://developer.java.sun.com/developer/technicalArticles/Networking/timeouts/"
Method Summary |
static java.net.Socket |
getSocket(java.net.InetAddress address,
int port,
int timeout)
gets a socket that is connected to IP address and port, times out after timeout ms |
static java.net.Socket |
getSocket(java.lang.String host,
int port,
int timeout)
gets a socket that is connected to host and port, times out after timeout ms. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SocketFactory
public SocketFactory()
getSocket
public static java.net.Socket getSocket(java.lang.String host,
int port,
int timeout)
throws java.io.IOException,
java.io.InterruptedIOException
- gets a socket that is connected to host and port, times out after timeout ms.
The host:address is cached for better performance
- Parameters:
host
- the host to connect toport
- the port to connect totimeout
- the amount of time to try to connect (in ms)- Returns:
- a socket connected
getSocket
public static java.net.Socket getSocket(java.net.InetAddress address,
int port,
int timeout)
throws java.io.IOException,
java.io.InterruptedIOException
- gets a socket that is connected to IP address and port, times out after timeout ms
- Parameters:
address
- the IP address to connect toport
- the port to connect totimeout
- the amount of time to try to connect (in ms)- Returns:
- a socket connected
(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.