twcsckernel.projectbase.rmi.socketfactory
Class ServerTwoWaySocketFactory

java.lang.Object
  extended by java.rmi.server.RMISocketFactory
      extended by twcsckernel.projectbase.rmi.socketfactory.ServerTwoWaySocketFactory
All Implemented Interfaces:
java.rmi.server.RMIClientSocketFactory, java.rmi.server.RMIServerSocketFactory

public class ServerTwoWaySocketFactory
extends java.rmi.server.RMISocketFactory

Server side socket factory which allows the server to make callbacks to a client whose address is unreachable from the server (as long as the server is reachable from the client).

Author:
Tim Taylor

Constructor Summary
ServerTwoWaySocketFactory(int timeout)
          Dla inicjacji połączenia do klienta będzie stosowany wskazany timeout.
 
Method Summary
 void addRequestSocket(byte[] address, java.net.Socket socket)
          Add a request socket to the factory.
 java.net.ServerSocket createServerSocket(int port)
          Returns a server socket for handling the two-way protocol.
 java.net.Socket createSocket(java.lang.String address, int port)
          Create a socket connectoin to the host of the given address and port.
 
Methods inherited from class java.rmi.server.RMISocketFactory
getDefaultSocketFactory, getFailureHandler, getSocketFactory, setFailureHandler, setSocketFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerTwoWaySocketFactory

public ServerTwoWaySocketFactory(int timeout)
Dla inicjacji połączenia do klienta będzie stosowany wskazany timeout. Jeśli połączenie zostanie ustawione poprawnie timeout jest ustawiany na zero.

Parameters:
timeout - - timeout łączenia z klientem
Method Detail

addRequestSocket

public void addRequestSocket(byte[] address,
                             java.net.Socket socket)
                      throws java.io.IOException
Add a request socket to the factory. The factory will use this socket to request a callback socket from the host of the given address.

Parameters:
address - Address of the client
socket - Socket on which to request callback sockets from the client.
Throws:
java.io.IOException

createSocket

public java.net.Socket createSocket(java.lang.String address,
                                    int port)
                             throws java.io.IOException
Create a socket connectoin to the host of the given address and port. If the address is for a host that has provided a callback socket request signalling channel, then that channel is used to request that the client create the socket. Otherwise a socket is created directly to the client from the server.

Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Specified by:
createSocket in class java.rmi.server.RMISocketFactory
Parameters:
address - Address for the socket.
port - Port for the socket.
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Returns a server socket for handling the two-way protocol.

Specified by:
createServerSocket in interface java.rmi.server.RMIServerSocketFactory
Specified by:
createServerSocket in class java.rmi.server.RMISocketFactory
Parameters:
port - Port on which the socket will listen.
Throws:
java.io.IOException


Copyright © 2005-2006 CS@PUT. All Rights Reserved.