Changed Server to new protocol on port 9999 with only one String based

communication exchange
This commit is contained in:
2019-04-15 11:14:06 +02:00
parent 141374eee3
commit c4ed32689d
14 changed files with 36 additions and 48 deletions

View File

@@ -15,7 +15,6 @@ implements Runnable {
this.PORT = port;
}
boolean updateNeeded = true;
ServerSocket ses;
Socket s;
DataOutputStream out;
@@ -25,25 +24,14 @@ implements Runnable {
do {
try {
do {
updateNeeded = true;
ses = new ServerSocket(this.PORT);
s = ses.accept();
System.out.println("Connected with: " + s.getInetAddress());
out = new DataOutputStream(s.getOutputStream());
in = new DataInputStream(s.getInputStream());
out.writeFloat(Start.version);
System.out.println(in.readUTF());
out.writeUTF("VERSION="+Start.version);
System.out.println(in.readUTF());
System.out.println(in.readUTF());
System.out.println(in.readUTF());
System.out.println(in.readUTF());
updateNeeded = in.readBoolean();
if (updateNeeded) {
System.out.println("Update needed, Download link was send");
out.writeUTF(Start.download);
}
out.close();
in.close();
s.close();

View File

@@ -6,7 +6,6 @@ import run.UpdateThread;
public class Start {
public static float version = -1.0f;
public static String download = "";
private static final int PORT = 9999;
@@ -14,7 +13,6 @@ public class Start {
public static void main(String[] args) {
version = Float.parseFloat(JOptionPane.showInputDialog("QuickLaunch version:"));
download = JOptionPane.showInputDialog("Link to downloadable");
Thread ut = new Thread(new UpdateThread());
ut.start();
System.out.println("Update thread started");

View File

@@ -9,7 +9,6 @@ implements Runnable {
public void run() {
do {
Start.version = Float.parseFloat(JOptionPane.showInputDialog("QuickLaunch version (" + Start.version + "): "));
Start.download = JOptionPane.showInputDialog("Link to downloadable:");
} while (true);
}
}