Class BaseClientListener

All Implemented Interfaces:
Listener, Runnable

public class BaseClientListener extends BaseListener implements Listener
The BaseClientListener is a subclass of BaseListener that handles the communication with clients in the chat application.
  • Constructor Details

    • BaseClientListener

      public BaseClientListener(int portIn, StreamIO streamIO, TransportFactory transportFactory)
      Constructs a BaseClientListener with the specified input port, StreamIO, and TransportFactory.
      Parameters:
      portIn - the input port number to listen for incoming connections
      streamIO - the StreamIO object for handling input and output streams
      transportFactory - the TransportFactory object for creating a listener
  • Method Details

    • worker

      protected void worker() throws IOException
      Continuously waits for incoming messages from clients, prints the message, and closes the connection.
      Specified by:
      worker in class BaseListener
      Throws:
      IOException - if an error occurs while receiving or handling the message