public class UpgradeTransmitter
extends java.lang.Object
implements java.lang.Runnable
UpgradeTransmitter is responsible for transmitting the upgrade file to the client. | Modifier and Type | Field and Description |
|---|---|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private java.net.Socket |
mySocket
The socket used to communicate with the client.
|
private java.io.File |
myUpgradeFolder
The folder containing the upgrade file.
|
private java.lang.Thread |
upgradeTransmitterThread
Thread used by the class.
|
| Constructor and Description |
|---|
UpgradeTransmitter(java.net.Socket mySocket,
java.io.File myUpgradeFolder)
Creates the class.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
authenticateClient()
Authenticates the client.
|
private boolean |
receivedUpgradeRequest()
Receives the information whether the client wants to download the upgrade from the server or not.
|
void |
run()
Runs the thread.
|
private void |
sendVersionNumber()
Sends version of the available upgrade to the client.
|
void |
start()
Starts the thread.
|
private boolean |
transferFile()
Transfers the upgrade file from the server to the client.
|
private static org.apache.log4j.Logger log
private java.lang.Thread upgradeTransmitterThread
private java.io.File myUpgradeFolder
private java.net.Socket mySocket
public UpgradeTransmitter(java.net.Socket mySocket,
java.io.File myUpgradeFolder)
mySocket - socket used to communicate with the clientmyUpgradeFolder - folder containing the upgrade filepublic void start()
public void run()
run in interface java.lang.Runnableprivate boolean authenticateClient()
throws java.io.IOException
true if the client is authenticated, false otherwisejava.io.IOException - if a communication problem occursprivate void sendVersionNumber()
throws java.io.IOException
java.io.IOException - if a communication problem existsprivate boolean receivedUpgradeRequest()
throws java.io.IOException
true if the client wants the upgrade, false otherwisejava.io.IOException - if a communication problem occursprivate boolean transferFile()
true if the upgrade file was transferred successfully, false otherwise