java.lang.Object
com.example.brickpaint.Client
- All Implemented Interfaces:
Runnable
[WORK IN PROGRESS]
Handles creation of a client connection to a corresponding server
- Author:
- matde
-
Constructor Summary
ConstructorsConstructorDescriptionClient(int port, InetAddress address, ButtonManager manager1) Client constructor that initializes a socket with the specified params -
Method Summary
Modifier and TypeMethodDescriptionstatic InetAddressdiscoverServer(int port) Helper function that begins the discovery process and returns the designated Inetaddress of an application server if one is found, else it will throw an appropriate errorvoidrun()Thread method that initializes the client handler for this clientvoidsendImageToServer(BufferedImage image) Sends an image to the connected servervoidstop()Helper function that closes the client socket and handler thread
-
Constructor Details
-
Client
Client constructor that initializes a socket with the specified params- Parameters:
port- The port the client should run onaddress- The Inetaddress the client should usemanager1- The UI Controller for the application
-
-
Method Details
-
discoverServer
Helper function that begins the discovery process and returns the designated Inetaddress of an application server if one is found, else it will throw an appropriate error- Parameters:
port- The port to look for a server on- Returns:
- The Inetaddress of the first server found
- Throws:
IOException- Error changes based on why the task failed
-
stop
public void stop()Helper function that closes the client socket and handler thread -
sendImageToServer
Sends an image to the connected server- Parameters:
image- The image that gets sent to the server
-
run
public void run()Thread method that initializes the client handler for this client
-