chatapp
Class ChatClient

java.lang.Object
  extended by chatapp.ChatClient

 class ChatClient
extends java.lang.Object

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.

Version:
$Id: ChatClient.java,v 1.2 2009/01/15 02:54:00 zahorjan Exp $

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

logger

private Logger logger
An object encapsulating creation of a log file. The log file has the name of the chat 'user'.log, e.g., alice.log. The log file is used by scripts (go.sh, in particular) to check the results for correctness.


sock

private TOMCastSocket sock
The communication socket.


receivePkt

private TOMCastPacket receivePkt
The packet used by the receive thread (to hold incoming data).


sendPkt

private TOMCastPacket sendPkt
The packet used by the send thread (to hold outgoing data).

Constructor Detail

ChatClient

public ChatClient(java.lang.String userName,
                  java.lang.String lobbyHost,
                  int lobbyPort,
                  int sendLimit,
                  int sendDelay)
A lot of parameters are required. It's intended that it be launched from a script...

Parameters:
userName - The string name to be used in tagging chat lines (e.g., alice)
lobbyHost - The hostname or IP address where the lobby is running
sendLimit - The number of simulated chat input lines to send before terminating
sendDelay - The number of milliseconds to wait between sending successive lines.
Method Detail

usage

public static void usage()

main

public static void main(java.lang.String[] args)