Package edu.pdx.cs410J.net
Class ChatListener
java.lang.Object
edu.pdx.cs410J.net.ChatListener
- All Implemented Interfaces:
Runnable
A
ChatListener runs in the background and listens for
messages on a socket on localhost.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns all incoming messages.voidrun()Sit in a loop and wait for messages to come in.voidSets the socket on which thisChatListenerlistens
-
Constructor Details
-
ChatListener
public ChatListener()Creates a newChatListener
-
-
Method Details
-
setSocket
Sets the socket on which thisChatListenerlistens -
run
Sit in a loop and wait for messages to come in. Unfortunately, calling the constructor ofObjectInputStreamblocks. So, we have to encode a "STOP" command in the final message. Awful. -
getMessages
Returns all incoming messages. This method will be called by a thread other than the one running run().
-