| 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.comm.SocketBasedInfrastructureImpl
public class SocketBasedInfrastructureImpl
The class implements a socket-based infrastructure for catp.
 It is similar to QueueBasedInfrastructureImpl in the sense that both
 are asynchronous. They differ in two aspects:
 QueueBasedInfrastructureImpl does not require network resources, thus
 for instance avoiding possible port conflicts as in
 SocketBasedInfrastructureImpl, but
 SocketBasedInfrastructureImpl supports the real distributed game
 playing over the Internet and is the only available infrastructure
 implementation for actual competitions while
 QueueBasedInfrastructureImpl implies multiple threads with each for
 the game server or one of the clients inside a single process.
 
Parameters
| base.server string (default: localhost)  | 
 (the domain name or IP address of the cat game server) | 
| base.port int (default: 9090)  | 
 (the port number the cat game server will be listening to) | 
Default Base
| socket_based_infrastructure | 
QueueBasedInfrastructureImpl, 
CallBasedInfrastructureImpl| Field Summary | |
|---|---|
static java.lang.String | 
P_DEF_BASE
 | 
static java.lang.String | 
P_PORT
 | 
static java.lang.String | 
P_SERVER
 | 
protected  int | 
port
 | 
protected  java.lang.String | 
server
 | 
| Constructor Summary | |
|---|---|
SocketBasedInfrastructureImpl()
 | 
|
| Method Summary | |
|---|---|
protected  void | 
allocatePort()
 | 
 void | 
cleanUp()
cleans up after finishing using this infrastructure.  | 
 ClientConnector<CatpMessage> | 
createClientConnector()
can be invoked by a GameClient to create a
 ClientConnector so as to connect to a
 GameServer. | 
 ServerConnector<CatpMessage> | 
createServerConnector()
can be invoked by a GameServer to create a
 ServerConnector so as to be able to wait for connection requests
 from GameClients. | 
static SocketBasedInfrastructureImpl | 
getInstance()
 | 
 int | 
getPort()
 | 
 java.lang.String | 
getServer()
 | 
protected  void | 
initialize()
 | 
 boolean | 
isSynchronous()
 | 
 void | 
setPort(int port)
sets the port number of the catp server.  | 
 void | 
setServer(java.lang.String server)
sets the domain name or ip address of the catp server.  | 
 void | 
setup(edu.cuny.config.param.ParameterDatabase parameters,
      edu.cuny.config.param.Parameter base)
 | 
 java.lang.String | 
toString()
 | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final java.lang.String P_DEF_BASE
public static final java.lang.String P_SERVER
public static final java.lang.String P_PORT
protected int port
protected java.lang.String server
| Constructor Detail | 
|---|
public SocketBasedInfrastructureImpl()
| Method Detail | 
|---|
public static SocketBasedInfrastructureImpl getInstance()
public void setup(edu.cuny.config.param.ParameterDatabase parameters,
                  edu.cuny.config.param.Parameter base)
setup in interface edu.cuny.config.param.Parameterizableprotected void initialize()
protected void allocatePort()
public ClientConnector<CatpMessage> createClientConnector()
InfrastructureGameClient to create a
 ClientConnector so as to connect to a
 GameServer.
createClientConnector in interface Infrastructure<CatpMessage>SocketBasedCatpClientConnector.public ServerConnector<CatpMessage> createServerConnector()
InfrastructureGameServer to create a
 ServerConnector so as to be able to wait for connection requests
 from GameClients.
createServerConnector in interface Infrastructure<CatpMessage>SocketBasedCatpServerConnector.public void cleanUp()
Infrastructure
cleanUp in interface Infrastructure<CatpMessage>public java.lang.String getServer()
public void setServer(java.lang.String server)
server - public int getPort()
public void setPort(int port)
port - public boolean isSynchronous()
isSynchronous in interface Infrastructure<CatpMessage>public java.lang.String toString()
toString in class java.lang.Object
  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||