public class UpgradeClient
extends java.lang.Object
UpgradeClient is responsible for receiving upgrade of the VBS client from the server.
If upgrade is detected, it is stored in the local directory. The upgrade is applied during the next application startup
by YAJSW - the wrapper which allows to run the VBS client as a Windows service or as a Linux daemon.| Modifier and Type | Field and Description |
|---|---|
private static int |
DEFAULT_BUFFERSIZE
Size of the buffer used to read data from sockets.
|
private java.net.InetAddress |
ip
IP address of the VBS server.
|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private java.net.Socket |
mySocket
The socket used for communication with the VBS server.
|
private int |
port
Number of the TCP port on the VBS server on which it listens for upgrade requests.
|
| Constructor and Description |
|---|
UpgradeClient(java.lang.String ip,
int port)
Constructs the class.
|
| Modifier and Type | Method and Description |
|---|---|
private int |
receiveClientVersionOnServer()
Receives version of the VBS client which is available on the server.
|
private boolean |
receiveUpgradeFromTheServer()
Receives the upgrade file from the VBS server.
|
void |
upgrade()
Initiates the process of downloading the upgrade.
|
private static final int DEFAULT_BUFFERSIZE
private static org.apache.log4j.Logger log
private java.net.Socket mySocket
private int port
private java.net.InetAddress ip
public UpgradeClient(java.lang.String ip,
int port)
throws java.io.IOException
ip - IP address of the VBS serverport - number of the TCP port on the VBS server on which it listens for upgrade requestsjava.io.IOException - if the IP address of the server is invalidpublic void upgrade()
private int receiveClientVersionOnServer()
throws java.lang.Exception
java.lang.Exception - when there is a problem with communication with the VBS serverprivate boolean receiveUpgradeFromTheServer()
throws java.lang.Exception
true if the file was successfully received, false otherwisejava.lang.Exception - when there is a problem with communication with the VBS server