Class TalkServer
java.lang.Object
|
+----TalkServer
- public class TalkServer
- extends Object
TalkServer - Server class for the NetTalk application. This class supports
a TCP/IP based server that uses the Java client/server socket paradigm to
communicate with a number of clients.
- Author:
- Jayme Manning, Paul Kronenwetter
-
index
-
-
VERSION
-
-
TalkServer(int)
- TalkServer - Constructor for the server portion of the
NetTalk application.
-
main(String[])
- main - Method used to start the server itself from the command
line.
-
processMessage(String, String)
- processMessage - Method used to distribute messages amongst our
clients.
-
registerClient(TalkServer. ClientThread)
- registerClient - Method used to register our ClientThread
within our storage Vector.
-
removeClient(int)
- removeClient - Method used to remove a client from our active list.
-
sendAll(String)
- sendAll - Method that is used to propagate a command message to all
connected clients.
-
sendAll(String, String)
- sendAll - Method that is used to propagate an user message to all
connected clients.
-
sendSpecific(String, String)
- sendSpecific - Method used to send a message to an individual
user.
-
sendSpecificCommand(String, String)
- sendSpecificCommand - Method used to send a command message to
an individual user.
-
updateUserList(String)
- updateUserList - Method used to send the given user a complete
update of the list of connected users.
index
public static int index
VERSION
public static final double VERSION
TalkServer
public TalkServer(int tmpPort)
- TalkServer - Constructor for the server portion of the
NetTalk application.
- Parameters:
- tmpPort - Integer representing the port that the server
is starting up on.
registerClient
public void registerClient(TalkServer. ClientThread newClient)
- registerClient - Method used to register our ClientThread
within our storage Vector. Registered clients will receive
appropriate message that deal with application control, etc...
- Parameters:
- newClient - ClientThread to register for operations.
removeClient
public void removeClient(int remIndex)
- removeClient - Method used to remove a client from our active list.
This method should be called either when a client disconnects
intentionally, or the connection is somehow broken.
- Parameters:
- remIndex - - The index of the client to remove.
processMessage
public void processMessage(String message,
String from)
- processMessage - Method used to distribute messages amongst our
clients. This method takes a single parameter (the message
string), and parses any control comments from the string before
actually distributing it to the appropriate clients.
- Parameters:
- message - The String that was read from a client that needs
to be distributed.
sendAll
public void sendAll(String message)
- sendAll - Method that is used to propagate a command message to all
connected clients.
- Parameters:
- message - The String that is to be sent to all clients.
sendAll
public void sendAll(String message,
String from)
- sendAll - Method that is used to propagate an user message to all
connected clients.
- Parameters:
- message - The String that is to be sent to all clients.
- from - The user that originated the message.
sendSpecific
public void sendSpecific(String message,
String from)
- sendSpecific - Method used to send a message to an individual
user. This method will parse the destination from the String.
Because this message is to be parsed to glean the user name to
send to, this method is used only with the MESSAGETO: token.
- Parameters:
- message - The message to be parsed and sent.
- from - The originator of the message.
sendSpecificCommand
public void sendSpecificCommand(String message,
String user)
- sendSpecificCommand - Method used to send a command message to
an individual user.
- Parameters:
- message - The command message.
- user - The user to send the message to.
updateUserList
public void updateUserList(String userName)
- updateUserList - Method used to send the given user a complete
update of the list of connected users.
- Parameters:
- userName - The user that we send the update list.
main
public static void main(String args[])
- main - Method used to start the server itself from the command
line. There should be only one command line option.
- Parameters:
- args[0] - This should be an integer representing a port
number that the server will start up on.