|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.transjam.util.ClientBase | +--com.transjam.client.Client
TransJam client. Handles basic communication with TransJam server. Keeps track of users in the same room.
Fields inherited from class com.transjam.util.ClientBase |
APPLICATION_LEVEL, DEFAULT_TIMEOUT_MSEC, hadError, ifValid, LOBBY_LEVEL, LOGIN_LEVEL, writer |
Constructor Summary | |
Client()
Create client and connect to server on given port. |
|
Client(java.lang.String serverName,
int portnum)
|
|
Client(java.lang.String serverName,
int portnum,
int timeoutMSec)
|
Method Summary | |
void |
addMessageListener(TransjamMessageListener listener)
|
void |
addMessageListener(TransjamMessageListener listener,
int level)
Request any messages received from server. |
java.lang.String |
getUserName(int userID)
|
void |
gotMessage(TransjamMessage message)
Called by ClientMonitor. |
void |
gotStart()
Called one when monitor starts. |
void |
gotStop()
|
void |
gotThrowable(java.lang.Throwable exc)
Called by ClientMonitor. |
void |
gotTimeout(int numTimeouts)
A timeout has been detected on a socket input stream read(). |
void |
grantLock(java.lang.String name)
Give lock to server which has requested it. |
void |
joinNewRoom(java.lang.String name)
|
void |
joinNewRoom(java.lang.String name,
int maxClients,
int flags)
Attempt to create a uniquely named room. |
void |
joinOldRoom(java.lang.String name)
Attempt to join an existing room. |
void |
joinRoom(java.lang.String name)
Attempt to join a room. |
void |
joinRoom(java.lang.String name,
int maxClients,
int flags)
Attempt to join a room. |
void |
leaveRoom()
Write a message requesting that to leave the room. |
void |
lockNewThing(java.lang.String name,
java.lang.String contents)
Attempt to create and lock a uniquely named Thing. |
void |
lockOldThing(java.lang.String name)
Attempt to lock an existing Thing. |
void |
processMessage(TransjamMessage message)
Handles various messages from server. |
void |
removeMessageListener(TransjamMessageListener listener)
|
void |
removeMessageListener(TransjamMessageListener listener,
int level)
|
void |
requestLogin(java.lang.String userName)
Login to server with the given name or handle. |
void |
requestLogout()
|
void |
requestRoomList()
Ask the server to send a list of users in the room. |
void |
requestThingList()
Ask the server to send a list of things in the room. |
void |
requestTime()
Request that the server send its UTC time value in milliseconds. |
void |
requestUserList()
Ask the server to send a list of users in the room. |
void |
requestUserLocations()
Request the location of the current and future users inside a room. |
void |
sendChat(java.lang.String msg,
int flags)
Send a text message to everyone else in the room. |
void |
serverDown()
Thread listening to server caught an IOException. |
void |
sync()
Wait for all pending messages to be responded to by server. |
void |
unlockThing(java.lang.String name)
|
void |
write(java.lang.String msg)
|
Methods inherited from class com.transjam.util.ClientBase |
addMeeting, beginGracefulShutdown, checkValidationMessage, checkValidity, closeSocket, debugln, deleteThing, denyLock, getName, getSocket, getUserID, isActive, isBroken, joinMeeting, lockThing, modifyThing, replyEcho, requestEcho, requestMeetingList, requestValidation, sendAll, sendInfo, sendOthers, sendSelf, sendSync, sendUser, setActive, setName, setSocket, setUserID, start, stop, writeSocket |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Client() throws java.net.UnknownHostException, java.io.IOException
public Client(java.lang.String serverName, int portnum) throws java.net.UnknownHostException, java.io.IOException
public Client(java.lang.String serverName, int portnum, int timeoutMSec) throws java.net.UnknownHostException, java.io.IOException
Method Detail |
public java.lang.String getUserName(int userID)
public void gotTimeout(int numTimeouts) throws java.io.IOException
gotTimeout
in class ClientBase
public void gotThrowable(java.lang.Throwable exc)
ClientBase
gotThrowable
in class ClientBase
com.transjam.util.ClientBase
exc
- public void gotStart()
ClientMonitorListener
gotStart
in class ClientBase
public void gotStop()
gotStop
in class ClientBase
public void sync() throws java.lang.InterruptedException, java.io.IOException
public void addMessageListener(TransjamMessageListener listener, int level)
public void removeMessageListener(TransjamMessageListener listener, int level)
public void addMessageListener(TransjamMessageListener listener)
public void removeMessageListener(TransjamMessageListener listener)
public void gotMessage(TransjamMessage message)
ClientBase
gotMessage
in class ClientBase
com.transjam.util.ClientBase
message
- public void write(java.lang.String msg) throws java.io.IOException
write
in class ClientBase
public void processMessage(TransjamMessage message) throws java.io.IOException
public void serverDown()
public void requestLogin(java.lang.String userName) throws java.io.IOException
public void requestLogout() throws java.io.IOException
public void requestTime() throws java.io.IOException
public void joinRoom(java.lang.String name) throws java.io.IOException
public void joinRoom(java.lang.String name, int maxClients, int flags) throws java.io.IOException
maxClients
- Maximum number of clients allowed per Room. For chess, this would be two.public void joinNewRoom(java.lang.String name, int maxClients, int flags) throws java.io.IOException
maxClients
- Maximum number of clients allowed per Room. For chess, this would be two.public void joinNewRoom(java.lang.String name) throws java.io.IOException
public void joinOldRoom(java.lang.String name) throws java.io.IOException
maxClients
- Maximum number of clients allowed per Room. For chess, this would be two.public void leaveRoom() throws java.io.IOException
public void lockNewThing(java.lang.String name, java.lang.String contents) throws java.io.IOException
public void lockOldThing(java.lang.String name) throws java.io.IOException
public void unlockThing(java.lang.String name) throws java.io.IOException
public void grantLock(java.lang.String name) throws java.io.IOException
public void requestUserList() throws java.io.IOException
public void requestUserLocations() throws java.io.IOException
public void requestThingList() throws java.io.IOException
public void requestRoomList() throws java.io.IOException
public void sendChat(java.lang.String msg, int flags) throws java.io.IOException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |