FileDocCategorySizeDatePackage
LocalRMIClientSocketFactory.javaAPI DocGlassfish v2 API4347Fri May 04 22:33:46 BST 2007com.sun.enterprise.admin.server.core.channel

LocalRMIClientSocketFactory

public class LocalRMIClientSocketFactory extends Object implements Serializable, RMIClientSocketFactory
Local RMI Client Socket Factory. This class creates client sockets that connect to local loopback address. This class needs to be Serializable because RMI stubs contain a reference to client socket factory.

Fields Summary
private InetAddress
localLoopbackAddress
Constructors Summary
public LocalRMIClientSocketFactory()
Create a new local RMI Client Socket Factory. This method uses null argument to InetAddress.getByName() to determine local loopback address.

throws
UnknownHostException as thrown from the method InetAddress.getByName().

        localLoopbackAddress = InetAddress.getByName(null);
    
public LocalRMIClientSocketFactory(InetAddress localAddr)
Create a new local RMI Client Socket Factory on specified local IP address. Use this constructor when you know the local loopback IP address and do not want to handle UnknownHostException thrown by default constructor.

param
localAddr local loopback address.

        localLoopbackAddress = localAddr;
    
Methods Summary
public java.net.SocketcreateSocket(java.lang.String host, int port)
Create a new socket that connects to local loopback address and specified port. This method ignores host parameter. The method comes from the interface java.rmi.server.RMIClientSocketFactory

param
host host to connect to, this is ignored and local loopback address is used.
param
port port to connect to
throws
IOException if an IO error occurs while creating the socket
return
a Socket connected to local loopback address on specified port

        return new Socket(localLoopbackAddress, port);