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
-
Method Summary
Modifier and TypeMethodDescriptionReturns all incoming messages.void
run()
Sit in a loop and wait for messages to come in.void
Sets the socket on which thisChatListener
listens
-
Constructor Details
-
ChatListener
public ChatListener()Creates a newChatListener
-
-
Method Details
-
setSocket
Sets the socket on which thisChatListener
listens -
run
Sit in a loop and wait for messages to come in. Unfortunately, calling the constructor ofObjectInputStream
blocks. 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().
-