megamek.common.net
Class ConnectionFactory

java.lang.Object
  extended by megamek.common.net.ConnectionFactory

public class ConnectionFactory
extends java.lang.Object

Connections factory. Creates the Client/Server connections


Method Summary
 IConnection createClientConnection(java.lang.String host, int port, int id)
          Creates new Client (Client-Server) connection
 IConnection createServerConnection(java.net.Socket socket, int id)
          Creates new Server coinnection
static ConnectionFactory getInstance()
          Returns the factory instance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ConnectionFactory getInstance()
Returns the factory instance

Returns:
the factory instance

createClientConnection

public IConnection createClientConnection(java.lang.String host,
                                          int port,
                                          int id)
Creates new Client (Client-Server) connection

Parameters:
host - server host
port - server port
id - connection ID
Returns:
new client (client-server) connection

createServerConnection

public IConnection createServerConnection(java.net.Socket socket,
                                          int id)
Creates new Server coinnection

Parameters:
socket - socket to read/write
id - connection ID
Returns:
new Server coinnection