Class ClientHandler

java.lang.Object
com.example.brickpaint.ClientHandler
All Implemented Interfaces:
Runnable

public class ClientHandler extends Object implements Runnable
[WORK IN PROGRESS] Handles packets that are sent to Clients, with an option to handle data differently if the client is also a server
Author:
matde
  • Constructor Summary

    Constructors
    Constructor
    Description
    ClientHandler(Socket s, InputStream dis, OutputStream dos, ButtonManager manager1, boolean isServer)
    Constructor for the client handler that initializes the necesssary variables
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    run()
    Main thread function, continuously reads output stream for images, when found it will update the application canvas and send to other clients if designated as a server
    void
    Helper function that stops the loop in the thread, thus stopping the thread

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClientHandler

      public ClientHandler(Socket s, InputStream dis, OutputStream dos, ButtonManager manager1, boolean isServer)
      Constructor for the client handler that initializes the necesssary variables
      Parameters:
      s - The socket assigned to this handler
      dis - The Input Stream assigned to the handler
      dos - The Output Stream assigned to the handler
      manager1 - The UI Controller for the application
      isServer - Boolean that determines if the handler should also handle server data
  • Method Details

    • stop

      public void stop()
      Helper function that stops the loop in the thread, thus stopping the thread
    • run

      public void run()
      Main thread function, continuously reads output stream for images, when found it will update the application canvas and send to other clients if designated as a server
      Specified by:
      run in interface Runnable