monrovia.client.protocol
Class ProtocolClient

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--monrovia.client.protocol.ProtocolClient
All Implemented Interfaces:
java.lang.Runnable

public class ProtocolClient
extends java.lang.Thread

ProtocolClient is the main class for connecting to the server.


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ProtocolClient(java.lang.String pServerAddr, int pServerTcpPort, ClientProtocolHandler pProtocolHandler, java.lang.String pName, java.lang.String pPassword)
          Constructor, initializes the ProtocolClient
ProtocolClient(java.lang.String pServerAddr, int pServerTcpPort, ClientProtocolHandler pProtocolHandler, java.lang.String pName, java.lang.String pPassword, boolean pUseUdp)
          Constructor, initializes the ProtocolClient
 
Method Summary
 void allowReceive()
          allowReceive allows the receiver to read packets
 void close()
          close tries to close all open resources
 void close(boolean pSendMessage)
          close tries to close all open resources
 void denyReceive()
          denyReceive skips denies the receiver the pleasure of reading packets
 void run()
          the implementation
 
Methods inherited from class java.lang.Thread
activeCount, currentThread, getPriority, isAlive, join, setPriority, sleep, start, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProtocolClient

public ProtocolClient(java.lang.String pServerAddr,
                      int pServerTcpPort,
                      ClientProtocolHandler pProtocolHandler,
                      java.lang.String pName,
                      java.lang.String pPassword)
Constructor, initializes the ProtocolClient
Parameters:
pServerAddr - the address of the server
pServerTcpPort - the port of the server
pProtocolHandler - the handler for the protocol
pName - the username of the client
pPassword - the password of the client

ProtocolClient

public ProtocolClient(java.lang.String pServerAddr,
                      int pServerTcpPort,
                      ClientProtocolHandler pProtocolHandler,
                      java.lang.String pName,
                      java.lang.String pPassword,
                      boolean pUseUdp)
Constructor, initializes the ProtocolClient
Parameters:
pServerAddr - the address of the server
pServerTcpPort - the port of the server
pProtocolHandler - the handler for the protocol
pName - the username of the client
pPassword - the password of the client
pUseUdp - true if udp, false if tcp
Method Detail

close

public void close()
close tries to close all open resources

close

public void close(boolean pSendMessage)
close tries to close all open resources
Parameters:
pSendMessage - sends a disconnected message to the screen if true

allowReceive

public void allowReceive()
allowReceive allows the receiver to read packets

denyReceive

public void denyReceive()
denyReceive skips denies the receiver the pleasure of reading packets

run

public void run()
the implementation
Overrides:
run in class java.lang.Thread