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
-
Method Summary
Modifier and TypeMethodDescriptionGets messages from theChatListener
void
run()
Make the connection to the socket.void
sendMessage
(ChatMessage message) Delegates to theChatSpeaker
void
startup()
Starts up thisChatCommunicator
.
-
Constructor Details
-
ChatCommunicator
Creates a newChatCommunicator
on a given port.
-
-
Method Details
-
startup
Starts up thisChatCommunicator
. -
run
Make the connection to the socket. If it cannot open aSocket
, is starts aSocketServer
and waits for a connection. Then, start the speaker and listener. -
sendMessage
Delegates to theChatSpeaker
-
getMessages
Gets messages from theChatListener
-