|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchatapp.ChatClient
class ChatClient
The chat client. Only trivial source code modifications are required to switch between use of MCast and TOMCast.
A ChatClient simulates a chat user. It generates lines to send, and sends them. It receives lines, and prints them. (It also writes them to a log file.) It doesn't terminate until it has sent all its lines and it is sure that it has received all msgs all other mcast group members will ever send.
| Nested Class Summary | |
|---|---|
(package private) class |
ChatClient.ReceiveHelper
Like most everything else, the chat client is multithreaded. |
| Field Summary | |
|---|---|
private Logger |
logger
An object encapsulating creation of a log file. |
private TOMCastPacket |
receivePkt
The packet used by the receive thread (to hold incoming data). |
private TOMCastPacket |
sendPkt
The packet used by the send thread (to hold outgoing data). |
private TOMCastSocket |
sock
The communication socket. |
| Constructor Summary | |
|---|---|
ChatClient(java.lang.String userName,
java.lang.String lobbyHost,
int lobbyPort,
int sendLimit,
int sendDelay)
A lot of parameters are required. |
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
|
static void |
usage()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Logger logger
private TOMCastSocket sock
private TOMCastPacket receivePkt
private TOMCastPacket sendPkt
| Constructor Detail |
|---|
public ChatClient(java.lang.String userName,
java.lang.String lobbyHost,
int lobbyPort,
int sendLimit,
int sendDelay)
userName - The string name to be used in tagging chat lines (e.g., alice)lobbyHost - The hostname or IP address where the lobby is runningsendLimit - The number of simulated chat input lines to send before terminatingsendDelay - The number of milliseconds to wait between sending successive lines.| Method Detail |
|---|
public static void usage()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||