|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.hprog.code.CodeProtocol
A TCP connection to a client or server. The protocol used, in either direction, consists of sequences of bytes indicating commands, followed by additional arguments of numbers and types specific to each command. The arguments are sent with ObjectInputStreams and ObjectOutputStreams.
Nested Class Summary | |
class |
CodeProtocol.Exn
Exception for network errors. |
Field Summary | |
boolean |
admin
Is this a client-to-server connection belonging to an operator? |
static byte |
ADMIN
Client-to-server command to declare a user an operator, and server-to-client command to notify that a user has become an operator. |
static byte |
ALIVE
Client-to-server command to indicate that the connection is alive. |
static byte |
AUTH
Client-to-server command to request operator status. |
static byte |
CARET
Either-way command to indicate the caret position in a shared source file. |
static byte |
CHAT
Client-to-server command to send a chat line, and server-to-client command to relay a line to appear in chat logs. |
static byte |
CLOSE
Client-to-server command to request deleting the session. |
static byte |
EDITOR
Client-to-server command to set a new editor, and server-to-client command to notify of a new editor. |
static byte |
ERR
Server-to-client command to indicate that an error has occurred. |
static byte |
FILE
Server-to-client command to give the contents of an existing shared source file. |
static byte |
HOST
Server-to-client command giving a user's Internet hostname. |
long |
idle
How long has this client been idle? |
static byte |
IDLE
Server-to-client command to indicate how long a user has been idle. |
static byte |
INFO
Client-to-server command requesting information on a user. |
static byte |
INSERT
Either-way command indicating an insertion in a shared source file. |
static byte |
INTERP_IN
Client-to-server command to make a query to the remote interpreter, and server-to-client command to notify clients of a pending query. |
static byte |
INTERP_OUT
Server-to-client command to notify of the result of a remote interpreter query. |
static byte |
INTERRUPT
Client-to-server command to request interrupting the remote interpreter. |
static byte |
JOIN
Server-to-client command indicating that a new user has joined the session. |
static byte |
LOAD
Client-to-server command to request loading all source files into the remote interpreter. |
static byte |
LOADING
Server-to-client command to indicate that source files are being loaded into the remote interpreter. |
static byte |
LOGIN
Client-to-server command to choose a handle. |
static byte |
NAME
Server-to-client command to indicate the initial presence of a user in the session. |
static byte |
NAMES
Server-to-client command to list current session users. |
static byte |
NEW_FILE
Client-to-server command to request creation of a new source file, and server-to-client command to notify of creation of a file. |
static byte |
PART
Server-to-client command indicating that a user has left the session. |
static byte |
REMOVE
Either-way command indicating a deletion from a shared source file. |
static byte |
SESSION
Client-to-server command to choose a session. |
static byte |
WELCOME
Server-to-client command to acknowledge successful login after SESSION and LOGIN. |
Constructor Summary | |
CodeProtocol(java.net.Socket sock)
|
Method Summary | |
void |
close()
Close the connection |
java.lang.String |
hostname()
Get hostname of remote end |
byte |
recvByte()
|
int |
recvInt()
|
long |
recvLong()
|
java.util.Set |
recvSet()
|
java.lang.String |
recvString()
|
void |
sendAdmin(java.lang.String handle)
|
void |
sendAlive()
|
void |
sendAuth(java.lang.String user,
java.lang.String pass)
|
void |
sendByte(byte b)
|
void |
sendCaret(java.lang.String fname,
int pos,
int len)
|
void |
sendChat(java.lang.String msg)
|
void |
sendEditor(java.lang.String handle)
|
void |
sendErr(java.lang.String msg)
|
void |
sendFile(java.lang.String name,
java.lang.String contents)
|
void |
sendHost(java.lang.String handle,
java.lang.String host)
|
void |
sendIdle(java.lang.String handle,
long msecs)
|
void |
sendInfo(java.lang.String handle)
|
void |
sendInsert(java.lang.String fname,
int pos,
java.lang.String text)
|
void |
sendInterpIn(java.lang.String msg)
|
void |
sendInterpOut(java.lang.String msg)
|
void |
sendInterrupt()
|
void |
sendJoin(java.lang.String handle)
|
void |
sendLoad()
|
void |
sendLogin(java.lang.String name)
|
void |
sendNames(java.util.Map names)
|
void |
sendNewFile(java.lang.String name)
|
void |
sendPart(java.lang.String handle)
|
void |
sendRemove(java.lang.String fname,
int pos,
int len)
|
void |
sendSession(java.lang.String name,
java.lang.String lang,
java.lang.String desc)
|
void |
sendSet(java.util.Set s)
|
void |
sendWelcome(java.lang.String lang)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte SESSION
public static final byte LOGIN
public static final byte CHAT
public static final byte WELCOME
public static final byte ERR
public static final byte NEW_FILE
public static final byte EDITOR
public static final byte NAMES
public static final byte JOIN
public static final byte PART
public static final byte INFO
public static final byte HOST
public static final byte FILE
public static final byte INSERT
public static final byte REMOVE
public static final byte INTERP_IN
public static final byte INTERP_OUT
public static final byte ALIVE
public static final byte IDLE
public static final byte ADMIN
public static final byte NAME
public static final byte AUTH
public static final byte INTERRUPT
public static final byte LOAD
public static final byte LOADING
public static final byte CARET
public static final byte CLOSE
public long idle
public boolean admin
Constructor Detail |
public CodeProtocol(java.net.Socket sock) throws CodeProtocol.Exn
sock
- socket to use for communicationMethod Detail |
public java.lang.String hostname()
public void close()
public java.lang.String recvString() throws CodeProtocol.Exn
CodeProtocol.Exn
public java.util.Set recvSet() throws CodeProtocol.Exn
CodeProtocol.Exn
public byte recvByte() throws CodeProtocol.Exn
CodeProtocol.Exn
public int recvInt() throws CodeProtocol.Exn
CodeProtocol.Exn
public long recvLong() throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendByte(byte b) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendLogin(java.lang.String name) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendSession(java.lang.String name, java.lang.String lang, java.lang.String desc) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendChat(java.lang.String msg) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendErr(java.lang.String msg) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendNewFile(java.lang.String name) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendFile(java.lang.String name, java.lang.String contents) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendEditor(java.lang.String handle) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendAdmin(java.lang.String handle) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendSet(java.util.Set s) throws java.io.IOException
java.io.IOException
public void sendNames(java.util.Map names) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendJoin(java.lang.String handle) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendPart(java.lang.String handle) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendWelcome(java.lang.String lang) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendInfo(java.lang.String handle) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendHost(java.lang.String handle, java.lang.String host) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendRemove(java.lang.String fname, int pos, int len) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendInsert(java.lang.String fname, int pos, java.lang.String text) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendCaret(java.lang.String fname, int pos, int len) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendInterpIn(java.lang.String msg) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendInterpOut(java.lang.String msg) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendAlive() throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendIdle(java.lang.String handle, long msecs) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendAuth(java.lang.String user, java.lang.String pass) throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendInterrupt() throws CodeProtocol.Exn
CodeProtocol.Exn
public void sendLoad() throws CodeProtocol.Exn
CodeProtocol.Exn
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |