|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.simpleSockets.ServeClient
Shell class for implementing multithreaded servers.
Field Summary | |
protected boolean |
alive
|
protected boolean |
debug
|
protected int |
id
|
protected SimpleServer |
server
|
protected ClientSocket |
socket
|
protected java.lang.Thread |
thread
|
Constructor Summary | |
ServeClient(SimpleServer server,
int ident)
|
|
ServeClient(SimpleServer server,
int ident,
java.lang.Thread t)
Every instance of this class will run on its own thread. |
Method Summary | |
void |
bind(java.net.Socket s)
Bind this awaiting client to the provided socket. |
protected int |
emitReply(java.lang.String reply)
|
protected int |
emitReplyStream(java.io.InputStream in)
|
java.lang.String |
getName()
|
protected void |
handleSocketException(java.lang.Exception ex)
Handle a socket exception during a readString(). |
boolean |
isBound()
Has a client been bound to us? |
void |
kill(boolean force)
|
protected void |
loop()
|
void |
loopForBinding()
While we claim to be alive and we have no bound socket, wait. |
void |
pause()
Sent the current thread into a wait state. |
protected java.lang.String |
processRequest(java.lang.String requestString)
// Override this method to process your request. |
java.io.InputStream |
processRequestStream(java.lang.String requestString)
|
void |
run()
Loop waiting for a client to be bound to us. |
protected boolean |
runConnection()
|
protected void |
terminateConnection()
|
void |
unbind()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.Thread thread
protected ClientSocket socket
protected SimpleServer server
protected boolean debug
protected boolean alive
protected int id
Constructor Detail |
public ServeClient(SimpleServer server, int ident)
public ServeClient(SimpleServer server, int ident, java.lang.Thread t)
Method Detail |
public void bind(java.net.Socket s) throws java.io.IOException
s
- The socket this client should now handle.
java.io.IOException
protected int emitReplyStream(java.io.InputStream in) throws java.io.IOException
java.io.IOException
protected int emitReply(java.lang.String reply) throws java.io.IOException
java.io.IOException
public java.lang.String getName()
protected void handleSocketException(java.lang.Exception ex)
ex
- The socket exception to handle.public boolean isBound()
public void kill(boolean force)
protected void loop() throws java.io.IOException, java.io.EOFException
java.io.IOException
java.io.EOFException
public void loopForBinding()
public void pause() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.io.InputStream processRequestStream(java.lang.String requestString)
protected java.lang.String processRequest(java.lang.String requestString)
public void run()
run
in interface java.lang.Runnable
protected boolean runConnection()
protected void terminateConnection()
public void unbind()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |