|
Scribble Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object cs101.net.BabySitter
This object handles the io between the server and one client. It has a run method that listens for information and relays it to the server. It also has a method to send information back to its client.
Copyright 1998 Massachusetts Institute of Technology
Field Summary | |
protected java.io.ObjectInputStream |
ois
Where to read from client |
protected java.io.ObjectOutputStream |
oos
Where to write to client |
protected Server |
server
Server this client is connected to |
protected java.net.Socket |
sock
Client connection |
protected java.lang.Thread |
spirit
Animacy that runs this object |
Constructor Summary | |
protected |
BabySitter(java.net.Socket sock,
Server server)
Creates a BabySitter to handle communication with a client. |
Method Summary | |
void |
run()
Recieves new info from clients. |
protected void |
send(java.lang.String s)
Sends a String to the client. |
protected void |
stop()
Should only be called by Server. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Server server
protected java.lang.Thread spirit
protected java.net.Socket sock
protected java.io.ObjectInputStream ois
protected java.io.ObjectOutputStream oos
Constructor Detail |
protected BabySitter(java.net.Socket sock, Server server)
sock
- the client socket of this threads clientserver
- The Server
object for this BabySittersend(java.lang.String)
,
Server.sendToAllExcept(java.lang.String, cs101.net.BabySitter)
Method Detail |
protected void send(java.lang.String s)
s
- the String to sendpublic void run()
run
in interface java.lang.Runnable
Server.sendToAllExcept(java.lang.String, cs101.net.BabySitter)
protected void stop()
Server.removeBabySitter(cs101.net.BabySitter)
|
Scribble Problem Set Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |