Package edu.pdx.cs410J.net
Class ChatCommunicator
java.lang.Object
edu.pdx.cs410J.net.ChatCommunicator
- All Implemented Interfaces:
Runnable
A
ChatCommunicator obtains a Socket and
then creates a ChatSpeaker and a
ChatListener that run in their own threads.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets messages from theChatListenervoidrun()Make the connection to the socket.voidsendMessage(ChatMessage message) Delegates to theChatSpeakervoidstartup()Starts up thisChatCommunicator.
-
Constructor Details
-
ChatCommunicator
Creates a newChatCommunicatoron a given port.
-
-
Method Details
-
startup
Starts up thisChatCommunicator. -
run
Make the connection to the socket. If it cannot open aSocket, is starts aSocketServerand waits for a connection. Then, start the speaker and listener. -
sendMessage
Delegates to theChatSpeaker -
getMessages
Gets messages from theChatListener
-