java.lang.Object
com.example.brickpaint.ClientHandler
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionClientHandler(Socket s, InputStream dis, OutputStream dos, ButtonManager manager1, boolean isServer) Constructor for the client handler that initializes the necesssary variables -
Method Summary
Modifier and TypeMethodDescriptionvoidrun()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 servervoidstop()Helper function that stops the loop in the thread, thus stopping the thread
-
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 handlerdis- The Input Stream assigned to the handlerdos- The Output Stream assigned to the handlermanager1- The UI Controller for the applicationisServer- 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
-