|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.collab.Server
public class Server
A generic server
| Field Summary | |
|---|---|
static int |
DEFAULT_PORT
_more_ |
| Constructor Summary | |
|---|---|
Server()
Create a new Server connection. |
|
Server(int port)
Create a new Server connection on the given port. |
|
| Method Summary | |
|---|---|
void |
addClient(Client client)
Add the given client to the list of clients managed by this server |
void |
addClient(Client client,
boolean andStartListening)
Add the given client to the list of clients managed by this server |
protected Client |
createClient(Socket clientSocket)
A factory method for creating a new client. |
List |
getClients()
_more_ |
boolean |
getIsRunning()
Get the IsRunning property. |
protected void |
handleIncomingMessage(Client fromClient,
String message)
Handle the message rcvd from the given client. |
boolean |
hasClients()
Does this server have any clients. |
protected void |
initClient(Socket clientSocket)
Create a new client object and listen for input. |
protected void |
logException(String msg,
Exception exc)
_more_ |
static void |
main(String[] args)
_more_ |
protected void |
notifyClientAdd(Client client)
Gets called when we have added a new client. |
protected void |
notifyClientRemove(Client client)
Gets called when we have removed a client. |
protected void |
notifyServerStart()
Gets called when we are starting to listen |
protected void |
notifyServerStop()
Gets called when we are done running on the server socket |
void |
removeClient(Client client)
Remove the given client from the list of clients managed by this server |
void |
startServer()
_more_ |
void |
startServer(int newPort)
_more_ |
void |
stopServer()
_more_ |
void |
write(String message)
_more_ |
void |
write(String message,
Client exceptClient)
_more_ |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int DEFAULT_PORT
| Constructor Detail |
|---|
public Server()
public Server(int port)
port - | Method Detail |
|---|
public void startServer(int newPort)
throws IOException
newPort -
IOException
public void startServer()
throws IOException
IOExceptionpublic void stopServer()
protected void notifyServerStart()
protected void notifyServerStop()
protected void notifyClientAdd(Client client)
client - protected void notifyClientRemove(Client client)
client - public boolean getIsRunning()
protected Client createClient(Socket clientSocket)
throws IOException
clientSocket - The socket we are connected to the client with.
IOExceptionprotected void initClient(Socket clientSocket)
clientSocket - public List getClients()
public boolean hasClients()
public void addClient(Client client)
client -
public void addClient(Client client,
boolean andStartListening)
client - andStartListening - public void removeClient(Client client)
client -
protected void handleIncomingMessage(Client fromClient,
String message)
fromClient - message - public void write(String message)
message -
public void write(String message,
Client exceptClient)
message - exceptClient -
protected void logException(String msg,
Exception exc)
msg - exc - public static void main(String[] args)
args -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||