|
Babylon Java Chat | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.lang.Thread
BabylonConnection
public abstract class BabylonConnection
An abstract class for connections from the client or to the server. Used
as a superclass for BabylonServerConnection and
BabylonClientConnection, this class contains common data fields
and methods for opening up the required data streams.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
protected java.util.Hashtable |
fileTransfers
|
protected java.util.Hashtable |
imageTransfers
|
protected java.io.DataInputStream |
iStream
|
protected long |
lastReceiveTime
|
protected long |
lastSendTime
|
protected boolean |
online
|
protected java.io.DataOutputStream |
oStream
|
protected double |
protocolVersion
|
protected java.net.Socket |
socket
|
protected java.lang.ThreadGroup |
threadGroup
|
protected BabylonConnection.WatchDog |
watchDog
|
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
BabylonConnection(java.lang.ThreadGroup tg,
java.lang.String name,
java.net.Socket s)
|
|
| Method Summary | |
|---|---|
protected abstract void |
lostConnection()
|
abstract void |
run()
|
protected void |
sendActivity(int fromId,
short activity,
int[] recipients)
Send notification to the requested recipients that a user is doing some activity, such as typing or drawing. |
protected void |
sendAllowUser(int fromId,
java.lang.String roomName,
int toId)
Send notification that a user, previously banned from a chat room, is now allowed. |
protected void |
sendBanUser(int fromId,
java.lang.String roomName,
int toId)
Sends notification that a user has been banned from a chat room. |
protected void |
sendBootUser(int fromId,
java.lang.String roomName,
int toId)
Send notification that a user is being booted from a chat room. |
protected void |
sendChatText(int fromId,
boolean priv,
java.lang.String data,
int[] recipients)
Send chat text to the requested recipients. |
protected void |
sendClearCanv(int fromId,
int[] recipients)
Send notification to the requested recipients that a user has cleared the drawing canvas. |
protected void |
sendConnect(java.lang.String userName)
Send a connection notification to the other end, to let it know that a user is connecting. |
protected void |
sendDisconnect(int userId,
java.lang.String mess)
Send out a broadcast that a user (possibly the sender himself) is disconnecting. |
protected void |
sendDrawText(int fromId,
short colour,
short x,
short y,
short type,
short attribs,
short size,
java.lang.String text,
int[] recipients)
Send drawing text (i.e. |
protected void |
sendEnterRoom(int fromId,
java.lang.String roomName,
boolean priv,
java.lang.String password,
boolean encrypted)
Send notification that a user is moving from one chat room to another. |
protected void |
sendError(int fromId,
short code,
int[] recipients)
Sends an error advisory to the requested recipients. |
protected void |
sendFile(int fromId,
java.lang.String fileName,
long totalSize,
int totalBlocks,
int blockSize,
int expireMins,
int[] recipients)
|
protected void |
sendFileAccept(int fromId,
int toId,
java.lang.String fileName,
boolean accept)
Send a notification about whether a client is accepting a file transfer invitation. |
protected void |
sendFileBlock(int fromId,
java.lang.String fileName,
int blockNumber,
byte[] data)
Send a file block packet of a file transfer. |
protected void |
sendFileCancel(int fromId,
java.lang.String fileName)
Send a cancellation notification for a file transfer. |
protected void |
sendImage(int fromId,
java.lang.String imageName,
short xCoord,
short yCoord,
int totalSize,
int totalBlocks,
int blockSize,
byte[] data,
int[] recipients)
Send a graphic image to the requested recipients, to be displayed on the drawing canvas. |
protected void |
sendImageBlock(int fromId,
java.lang.String imageName,
int blockNumber,
byte[] data)
Send a file block packet of an image transfer. |
protected void |
sendInstantMess(int fromId,
int toId,
java.lang.String message)
Send an instant message request to the requested recipient. |
protected void |
sendInvite(int fromId,
java.lang.String roomName,
int toId)
Send a chat room invitation from one user to another. |
protected void |
sendLeaveMess(int fromId,
java.lang.String toName,
java.lang.String message)
Send a stored message to be saved for the requested user name. |
protected void |
sendLine(int fromId,
short colour,
short startX,
short startY,
short endX,
short endY,
short thick,
int[] recipients)
Send a drawing line to the requested recipients. |
protected void |
sendPageUser(int fromId,
int[] recipients)
Send a paging request to the requested recipients. |
protected void |
sendPing()
Send a ping command to the connection on the other end, to let it know that we're still connected. |
protected void |
sendPoly(short kind,
int fromId,
short colour,
short x,
short y,
short width,
short height,
short thick,
boolean fill,
int[] recipients)
Send a drawing polygon to the requested recipients. |
protected void |
sendProtocol(double version)
Send a message to the other end about our desired protocol. |
protected void |
sendReadMess(int fromId)
Sends a request from the client to the server to retrieve stored messages. |
protected void |
sendRoomList(java.util.Vector rooms)
Send a 'rooms list' request. |
protected void |
sendSendEmail(int fromId,
java.lang.String mxHost,
java.lang.String fromAddress,
java.lang.String toAddress,
java.lang.String subject,
java.lang.String text)
Sends a 'send email' request from the client to the server with the supplied parameters and data. |
protected void |
sendServerMessage(java.lang.String data)
This will cause a message from the server to appear in a dialog window on the screen of the user. |
protected void |
sendServerText(java.lang.String data)
Send chat text from the server to be displayed in the recipients' chat windows. |
protected void |
sendStoredMess(java.util.Vector messages)
Send all of the stored messages to the requested recipient. |
protected void |
sendUserInfo(int id,
java.lang.String name,
java.lang.String password,
boolean encrypted,
java.lang.String email,
java.lang.String additional,
java.lang.String language)
Send information about user. |
protected void |
shutdown()
|
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected double protocolVersion
protected java.lang.ThreadGroup threadGroup
protected java.net.Socket socket
protected java.io.DataInputStream iStream
protected java.io.DataOutputStream oStream
protected boolean online
protected java.util.Hashtable fileTransfers
protected java.util.Hashtable imageTransfers
protected long lastSendTime
protected long lastReceiveTime
protected BabylonConnection.WatchDog watchDog
| Constructor Detail |
|---|
public BabylonConnection(java.lang.ThreadGroup tg,
java.lang.String name,
java.net.Socket s)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public abstract void run()
run in interface java.lang.Runnablerun in class java.lang.Threadprotected void sendProtocol(double version)
protected void sendPing()
protected void sendConnect(java.lang.String userName)
protected void sendUserInfo(int id,
java.lang.String name,
java.lang.String password,
boolean encrypted,
java.lang.String email,
java.lang.String additional,
java.lang.String language)
protected void sendServerMessage(java.lang.String data)
protected void sendDisconnect(int userId,
java.lang.String mess)
protected void sendRoomList(java.util.Vector rooms)
protected void sendInvite(int fromId,
java.lang.String roomName,
int toId)
protected void sendEnterRoom(int fromId,
java.lang.String roomName,
boolean priv,
java.lang.String password,
boolean encrypted)
protected void sendBootUser(int fromId,
java.lang.String roomName,
int toId)
protected void sendBanUser(int fromId,
java.lang.String roomName,
int toId)
protected void sendAllowUser(int fromId,
java.lang.String roomName,
int toId)
protected void sendActivity(int fromId,
short activity,
int[] recipients)
protected void sendChatText(int fromId,
boolean priv,
java.lang.String data,
int[] recipients)
protected void sendServerText(java.lang.String data)
protected void sendLine(int fromId,
short colour,
short startX,
short startY,
short endX,
short endY,
short thick,
int[] recipients)
protected void sendPoly(short kind,
int fromId,
short colour,
short x,
short y,
short width,
short height,
short thick,
boolean fill,
int[] recipients)
protected void sendDrawText(int fromId,
short colour,
short x,
short y,
short type,
short attribs,
short size,
java.lang.String text,
int[] recipients)
protected void sendImage(int fromId,
java.lang.String imageName,
short xCoord,
short yCoord,
int totalSize,
int totalBlocks,
int blockSize,
byte[] data,
int[] recipients)
protected void sendClearCanv(int fromId,
int[] recipients)
protected void sendPageUser(int fromId,
int[] recipients)
protected void sendInstantMess(int fromId,
int toId,
java.lang.String message)
protected void sendStoredMess(java.util.Vector messages)
protected void sendLeaveMess(int fromId,
java.lang.String toName,
java.lang.String message)
protected void sendReadMess(int fromId)
protected void sendError(int fromId,
short code,
int[] recipients)
protected void sendSendEmail(int fromId,
java.lang.String mxHost,
java.lang.String fromAddress,
java.lang.String toAddress,
java.lang.String subject,
java.lang.String text)
protected void sendFile(int fromId,
java.lang.String fileName,
long totalSize,
int totalBlocks,
int blockSize,
int expireMins,
int[] recipients)
protected void sendFileAccept(int fromId,
int toId,
java.lang.String fileName,
boolean accept)
protected void sendFileBlock(int fromId,
java.lang.String fileName,
int blockNumber,
byte[] data)
protected void sendFileCancel(int fromId,
java.lang.String fileName)
protected void sendImageBlock(int fromId,
java.lang.String imageName,
int blockNumber,
byte[] data)
protected abstract void lostConnection()
protected void shutdown()
|
Babylon Java Chat | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||