Enterprise Information Portal APIs

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/"


Constructor Summary
SocketFactory()
           
 
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
 

Constructor Detail

SocketFactory

public SocketFactory()
Method Detail

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 to
port - the port to connect to
timeout - 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 to
port - the port to connect to
timeout - the amount of time to try to connect (in ms)
Returns:
a socket connected

EIP Web Crawler APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.