|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
rmi.ChatParticipant
rmi.ChatServer
public class ChatServer
Class for server for simple chat program (with instructions for running the application). An object of this class functions as a server for the application.
| Field Summary |
|---|
| Fields inherited from class rmi.ChatParticipant |
|---|
clients, errorPrefix, serverPrefix |
| Fields inherited from class java.rmi.server.RemoteObject |
|---|
ref |
| Constructor Summary | |
|---|---|
ChatServer()
Constructs server object. |
|
| Method Summary | |
|---|---|
void |
addClient(ChatClientInterface c)
Adds client, printing some info to standard output and telling all previous clients to add this one. |
void |
broadcast(java.lang.String message)
Sends message to all clients. |
void |
display(java.lang.String message)
Displays message. |
java.util.List<ChatClientInterface> |
getClients()
Gets a list of clients. |
java.lang.String |
getMessagePrefix()
Gets prefix for messages broadcast by this object. |
static void |
main(java.lang.String[] args)
Main program -- creates a server object and registers it. |
void |
removeClient(ChatClientInterface c)
Removes client, printing some info to standard output and telling all other clients to remove this one. |
| Methods inherited from class java.rmi.server.UnicastRemoteObject |
|---|
clone, exportObject, exportObject, exportObject, unexportObject |
| Methods inherited from class java.rmi.server.RemoteServer |
|---|
getClientHost, getLog, setLog |
| Methods inherited from class java.rmi.server.RemoteObject |
|---|
equals, getRef, hashCode, toString, toStub |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public ChatServer()
throws java.rmi.RemoteException
java.rmi.RemoteException| Method Detail |
|---|
public void addClient(ChatClientInterface c)
throws java.rmi.RemoteException
addClient in interface ChatParticipantInterfaceaddClient in class ChatParticipantc - client to add
java.rmi.RemoteException
public void removeClient(ChatClientInterface c)
throws java.rmi.RemoteException
removeClient in interface ChatParticipantInterfaceremoveClient in class ChatParticipantc - client to remove
java.rmi.RemoteException
public void broadcast(java.lang.String message)
throws java.rmi.RemoteException
broadcast in interface ChatParticipantInterfacebroadcast in class ChatParticipantmessage - message to send to all
java.rmi.RemoteException
public void display(java.lang.String message)
throws java.rmi.RemoteException
display in interface ChatParticipantInterfacemessage - message to display
java.rmi.RemoteException
public java.util.List<ChatClientInterface> getClients()
throws java.rmi.RemoteException
getClients in interface ChatServerInterfacejava.rmi.RemoteExceptionpublic java.lang.String getMessagePrefix()
getMessagePrefix in class ChatParticipantpublic static void main(java.lang.String[] args)
args - command-line arguments -- not used
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||