public interface Client extends MessageConnection
CHANNEL_DEFAULT_RELIABLE, CHANNEL_DEFAULT_UNRELIABLE
Modifier and Type | Method and Description |
---|---|
void |
addClientStateListener(ClientStateListener listener)
Adds a listener that will be notified about connection
state changes.
|
void |
addErrorListener(ErrorListener<? super Client> listener)
Adds a listener that will be notified when any connection errors
occur.
|
void |
addMessageListener(MessageListener<? super Client> listener)
Adds a listener that will be notified when any message or object
is received from the server.
|
void |
addMessageListener(MessageListener<? super Client> listener,
java.lang.Class... classes)
Adds a listener that will be notified when messages of the specified
types are received.
|
void |
close()
Closes this connection to the server.
|
java.lang.String |
getGameName()
Returns the 'game name' for servers to which this client should be able
to connect.
|
int |
getId()
Returns a unique ID for this client within the remote
server or -1 if this client isn't fully connected to the
server.
|
ClientServiceManager |
getServices()
Returns the manager for client services.
|
int |
getVersion()
Returns the game-specific version of the server this client should
be able to connect to.
|
boolean |
isConnected()
Returns true if this client is fully connected to the
host.
|
boolean |
isStarted()
Returns true if this client has been started and is still
running.
|
void |
removeClientStateListener(ClientStateListener listener)
Removes a previously registered connection listener.
|
void |
removeErrorListener(ErrorListener<? super Client> listener)
Removes a previously registered error listener.
|
void |
removeMessageListener(MessageListener<? super Client> listener)
Removes a previously registered wildcard listener.
|
void |
removeMessageListener(MessageListener<? super Client> listener,
java.lang.Class... classes)
Removes a previously registered type-specific listener from
the specified types.
|
void |
send(int channel,
Message message)
Sends a message to the other end of the connection using
the specified alternate channel.
|
void |
send(Message message)
Sends a message to the server.
|
void |
start()
Starts the client allowing it to begin processing incoming
messages and delivering them to listeners.
|
void start()
boolean isConnected()
boolean isStarted()
int getId()
java.lang.String getGameName()
int getVersion()
ClientServiceManager getServices()
void send(Message message)
send
in interface MessageConnection
void send(int channel, Message message)
send
in interface MessageConnection
void close()
void addClientStateListener(ClientStateListener listener)
void removeClientStateListener(ClientStateListener listener)
void addMessageListener(MessageListener<? super Client> listener)
void addMessageListener(MessageListener<? super Client> listener, java.lang.Class... classes)
void removeMessageListener(MessageListener<? super Client> listener)
void removeMessageListener(MessageListener<? super Client> listener, java.lang.Class... classes)
void addErrorListener(ErrorListener<? super Client> listener)
void removeErrorListener(ErrorListener<? super Client> listener)