anon.util
Class SocketFactory

java.lang.Object
  extended by anon.util.SocketFactory

public class SocketFactory
extends java.lang.Object

This is an implementation to make the Socket creation process interruptable which offers also the opportunity to set a timeout for this process. Both possibilities are not available in the default Java Socket implementation.


Constructor Summary
SocketFactory()
           
 
Method Summary
static java.net.Socket createSocket(java.lang.String a_hostName, int a_port, long a_createTimeout)
          Creates a new Socket.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketFactory

public SocketFactory()
Method Detail

createSocket

public static java.net.Socket createSocket(java.lang.String a_hostName,
                                           int a_port,
                                           long a_createTimeout)
                                    throws java.lang.Exception
Creates a new Socket. A timeout can be set for this operation and also it is interruptable. If there occured an Exception while creating the Socket, this Exception is thrown. If the creation process was interrupted from outside, an InterrupedException is thrown (but the interrupted flag is not set on the thread). If a timeout was specified and reached, a normal Exception is thrown.

Parameters:
a_hostName - The hostname of the target or null for the loopback interface (see java.net.Socket).
a_port - The port of the target.
a_createTimeout - The timeout for creating the new Socket in milliseconds. A timeout of 0 means to wait forever (until Socket creation is ready).
Returns:
The created Socket.
Throws:
java.lang.Exception