public class SocketFactory extends Object
Modifier and Type | Method and Description |
---|---|
static Socket |
getSocket(Object caller)
Retrieve a socket which is connected to the default host/port.
|
static Socket |
getSocket(Object caller,
InetAddress iaddr,
int port)
Retrieve a connected socket to a specified destination
If the default host/port is not set, it will be set to the same as
the given socket.
|
static Socket |
getSocket(Object caller,
Socket s)
Retrieve a connected socket using a connected socket as basis.
|
static Socket |
getSocket(Object caller,
String hostname,
int port)
Retrieve a connected socket to a specified destination
If the default host/port is not set, it will be set to the same as
the given socket.
|
static SocketFactoryCallback |
getSocketFactoryCb()
Retrieve the SocketFactoryCallback.
|
static Socket |
getUnconnectedSocket(Object caller)
Retrieve an unconnected socket.
|
static void |
registerCallback(SocketFactoryCallback cb)
Register a SocketFactoryCallback that will be responsible for all
socket connection
|
static void |
setHostname(String hostname)
Set the default hostname for socket connections.
|
static void |
setPort(int port)
Set the default port number for socket connections
|
public static void setHostname(String hostname)
hostname
- public static void setPort(int port)
port
- public static Socket getUnconnectedSocket(Object caller) throws IOException, ConfException
caller
- The requestor object instanceIOException
ConfException
public static Socket getSocket(Object caller) throws IOException, ConfException
caller
- The requestor object instanceIOException
ConfException
public static Socket getSocket(Object caller, Socket s)
caller
- The requestor object instances
- public static Socket getSocket(Object caller, String hostname, int port) throws IOException, ConfException
caller
- The requestor object instancehostname
- The preferred hostport
- The preferred portIOException
ConfException
public static Socket getSocket(Object caller, InetAddress iaddr, int port) throws IOException, ConfException
caller
- The requestor object instanceiaddr
- The preferred addressport
- The preferred portIOException
ConfException
public static void registerCallback(SocketFactoryCallback cb)
cb
- SocketFactoryCallback instancepublic static SocketFactoryCallback getSocketFactoryCb()