edu.pdx.cs399J.net
Class ChatCommunicator

java.lang.Object
  extended by edu.pdx.cs399J.net.ChatCommunicator
All Implemented Interfaces:
Runnable

public class ChatCommunicator
extends Object
implements Runnable

A ChatCommunicator obtains a Socket and then creates a ChatSpeaker and a ChatListener that run in their own threads.


Constructor Summary
ChatCommunicator(int port)
          Creates a new ChatCommunicator on a given port.
 
Method Summary
 List getMessages()
          Gets messages from the ChatListener
 void run()
          Make the connection to the socket.
 void sendMessage(ChatMessage message)
          Delegates to the ChatSpeaker
 void startup()
          Starts up this ChatCommunicator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChatCommunicator

public ChatCommunicator(int port)
Creates a new ChatCommunicator on a given port.

Method Detail

startup

public void startup()
Starts up this ChatCommunicator.


run

public void run()
Make the connection to the socket. If it cannot open a Socket, is starts a SocketServer and waits for a connection. Then, start the speaker and listener.

Specified by:
run in interface Runnable

sendMessage

public void sendMessage(ChatMessage message)
Delegates to the ChatSpeaker


getMessages

public List getMessages()
Gets messages from the ChatListener



Copyright © 2000-2009 Portland State University. All Rights Reserved.