diff --git a/Task1/Client/.idea/artifacts/Client_jar.xml b/Task1/Client/.idea/artifacts/Client_jar.xml
new file mode 100644
index 0000000..4de7eb1
--- /dev/null
+++ b/Task1/Client/.idea/artifacts/Client_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Client_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/compiler.xml b/Task1/Client/.idea/compiler.xml
new file mode 100644
index 0000000..9064c5b
--- /dev/null
+++ b/Task1/Client/.idea/compiler.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/description.html b/Task1/Client/.idea/description.html
new file mode 100644
index 0000000..cc10d56
--- /dev/null
+++ b/Task1/Client/.idea/description.html
@@ -0,0 +1,2 @@
+Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/encodings.xml b/Task1/Client/.idea/encodings.xml
new file mode 100644
index 0000000..89d0f2f
--- /dev/null
+++ b/Task1/Client/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/gradle.xml b/Task1/Client/.idea/gradle.xml
new file mode 100644
index 0000000..3e3960b
--- /dev/null
+++ b/Task1/Client/.idea/gradle.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/misc.xml b/Task1/Client/.idea/misc.xml
new file mode 100644
index 0000000..365b68a
--- /dev/null
+++ b/Task1/Client/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/modules.xml b/Task1/Client/.idea/modules.xml
new file mode 100644
index 0000000..b7ec2d4
--- /dev/null
+++ b/Task1/Client/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/.idea/uiDesigner.xml b/Task1/Client/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/Task1/Client/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/Task1/Client/.idea/vcs.xml b/Task1/Client/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/Task1/Client/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Task1/Client/.idea/workspace.xml b/Task1/Client/.idea/workspace.xml
new file mode 100644
index 0000000..25b733a
--- /dev/null
+++ b/Task1/Client/.idea/workspace.xml
@@ -0,0 +1,301 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1359379246138
+
+
+ 1359379246138
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/src/sample/Controller.java
+ 22
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Client/Client.iml b/Task1/Client/Client.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Task1/Client/Client.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task1/Client/out/artifacts/Client_jar/Client.jar b/Task1/Client/out/artifacts/Client_jar/Client.jar
new file mode 100644
index 0000000..11bca56
Binary files /dev/null and b/Task1/Client/out/artifacts/Client_jar/Client.jar differ
diff --git a/Task1/Client/out/production/Client/META-INF/MANIFEST.MF b/Task1/Client/out/production/Client/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task1/Client/out/production/Client/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task1/Client/out/production/Client/sample/Client.class b/Task1/Client/out/production/Client/sample/Client.class
new file mode 100644
index 0000000..8620e32
Binary files /dev/null and b/Task1/Client/out/production/Client/sample/Client.class differ
diff --git a/Task1/Client/out/production/Client/sample/Controller.class b/Task1/Client/out/production/Client/sample/Controller.class
new file mode 100644
index 0000000..6a447b3
Binary files /dev/null and b/Task1/Client/out/production/Client/sample/Controller.class differ
diff --git a/Task1/Client/out/production/Client/sample/Main.class b/Task1/Client/out/production/Client/sample/Main.class
new file mode 100644
index 0000000..6a8c659
Binary files /dev/null and b/Task1/Client/out/production/Client/sample/Main.class differ
diff --git a/Task1/Client/out/production/Client/sample/sample.fxml b/Task1/Client/out/production/Client/sample/sample.fxml
new file mode 100644
index 0000000..e57aa16
--- /dev/null
+++ b/Task1/Client/out/production/Client/sample/sample.fxml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task1/Client/out/production/Client/sample/time-1738083_1280.jpg b/Task1/Client/out/production/Client/sample/time-1738083_1280.jpg
new file mode 100644
index 0000000..338554e
Binary files /dev/null and b/Task1/Client/out/production/Client/sample/time-1738083_1280.jpg differ
diff --git a/Task1/Client/src/META-INF/MANIFEST.MF b/Task1/Client/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task1/Client/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task1/Client/src/sample/Client.java b/Task1/Client/src/sample/Client.java
new file mode 100644
index 0000000..97973dc
--- /dev/null
+++ b/Task1/Client/src/sample/Client.java
@@ -0,0 +1,39 @@
+package sample;
+
+import java.io.*;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+public class Client{
+ private final String ip;
+ private final int port;
+ private Socket server;
+
+ public Client(String ip, int port) {
+ this.ip = ip;
+ this.port = port;
+ }
+
+ public void start() {
+ try {
+ server = new Socket(ip, port);
+ } catch (UnknownHostException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getTime(){
+ BufferedReader in = null;
+ String time = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(server.getInputStream()));
+ time = in.readLine();
+ System.out.println("!!!" + time);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return time;
+ }
+}
\ No newline at end of file
diff --git a/Task1/Client/src/sample/Controller.java b/Task1/Client/src/sample/Controller.java
new file mode 100644
index 0000000..9dab61f
--- /dev/null
+++ b/Task1/Client/src/sample/Controller.java
@@ -0,0 +1,34 @@
+package sample;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+
+
+public class Controller{
+ @FXML
+ Button btnConnect;
+ @FXML
+ Label lblDateTime;
+ Client client;
+
+
+ @FXML
+ public void connect(){
+ client = new Client("127.0.0.1", 1234);
+ client.start();
+ new Thread(()->{
+ while (true){
+ getTime();}
+ }).start();
+
+ }
+
+ public void getTime(){
+ String time = client.getTime();
+ System.out.println(time);
+ Platform.runLater(() -> lblDateTime.setText(time));
+ }
+}
+
diff --git a/Task1/Client/src/sample/Main.java b/Task1/Client/src/sample/Main.java
new file mode 100644
index 0000000..6a162e1
--- /dev/null
+++ b/Task1/Client/src/sample/Main.java
@@ -0,0 +1,23 @@
+package sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
+ primaryStage.setTitle("Clock");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Task1/Client/src/sample/sample.fxml b/Task1/Client/src/sample/sample.fxml
new file mode 100644
index 0000000..e57aa16
--- /dev/null
+++ b/Task1/Client/src/sample/sample.fxml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task1/Client/src/sample/time-1738083_1280.jpg b/Task1/Client/src/sample/time-1738083_1280.jpg
new file mode 100644
index 0000000..338554e
Binary files /dev/null and b/Task1/Client/src/sample/time-1738083_1280.jpg differ
diff --git a/Task1/Server/.idea/artifacts/Server_jar.xml b/Task1/Server/.idea/artifacts/Server_jar.xml
new file mode 100644
index 0000000..65d48ea
--- /dev/null
+++ b/Task1/Server/.idea/artifacts/Server_jar.xml
@@ -0,0 +1,11 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Server_jar
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Server/.idea/compiler.xml b/Task1/Server/.idea/compiler.xml
new file mode 100644
index 0000000..203afe7
--- /dev/null
+++ b/Task1/Server/.idea/compiler.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Server/.idea/misc.xml b/Task1/Server/.idea/misc.xml
new file mode 100644
index 0000000..628b248
--- /dev/null
+++ b/Task1/Server/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Server/.idea/workspace.xml b/Task1/Server/.idea/workspace.xml
new file mode 100644
index 0000000..89bf45c
--- /dev/null
+++ b/Task1/Server/.idea/workspace.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1593109498685
+
+
+ 1593109498685
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task1/Server/Server.iml b/Task1/Server/Server.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/Task1/Server/Server.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/Task1/Server/out/artifacts/Server_jar/Server.jar b/Task1/Server/out/artifacts/Server_jar/Server.jar
new file mode 100644
index 0000000..ded4e5d
Binary files /dev/null and b/Task1/Server/out/artifacts/Server_jar/Server.jar differ
diff --git a/Task1/Server/pom.xml b/Task1/Server/pom.xml
new file mode 100644
index 0000000..0eb1cd1
--- /dev/null
+++ b/Task1/Server/pom.xml
@@ -0,0 +1,12 @@
+
+
+ 4.0.0
+
+ org.example
+ Server
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/Task1/Server/src/META-INF/MANIFEST.MF b/Task1/Server/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..25b46ff
--- /dev/null
+++ b/Task1/Server/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Server
+
diff --git a/Task1/Server/src/main/java/Server.java b/Task1/Server/src/main/java/Server.java
new file mode 100644
index 0000000..52dfe42
--- /dev/null
+++ b/Task1/Server/src/main/java/Server.java
@@ -0,0 +1,46 @@
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+
+public class Server {
+ public static void main(String[] args) {
+ Server server = new Server();
+ server.start(1234);
+ }
+ public void start(int port){
+ String timeBefore=null;
+ String timeAfter=null;
+ try (ServerSocket serverSocket = new ServerSocket(port)) {
+ while (true) {
+ Socket client = serverSocket.accept();
+ System.out.println("New client connected");
+ OutputStream out = client.getOutputStream();
+ PrintWriter writer = new PrintWriter(out, true);
+ while (true) {
+ timeAfter = getTime();
+ if (!timeAfter.equals(timeBefore)){
+ timeBefore=timeAfter;
+ writer.println(timeBefore);
+ System.out.println(timeBefore);
+ }
+ }
+ }
+
+ } catch (IOException ex) {
+ System.out.println("Server exception: " + ex.getMessage());
+ ex.printStackTrace();
+ }
+ }
+ public String getTime(){
+ DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ Date date = new Date();
+ String result = dateFormat.format(date);
+ return result;
+ }
+}
\ No newline at end of file
diff --git a/Task1/Server/target/classes/Server.class b/Task1/Server/target/classes/Server.class
new file mode 100644
index 0000000..952f120
Binary files /dev/null and b/Task1/Server/target/classes/Server.class differ
diff --git a/Task2/Client/.idea/artifacts/Client_jar.xml b/Task2/Client/.idea/artifacts/Client_jar.xml
new file mode 100644
index 0000000..3569c65
--- /dev/null
+++ b/Task2/Client/.idea/artifacts/Client_jar.xml
@@ -0,0 +1,9 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Client_jar
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Client/.idea/compiler.xml b/Task2/Client/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/Task2/Client/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task2/Client/.idea/description.html b/Task2/Client/.idea/description.html
new file mode 100644
index 0000000..cc10d56
--- /dev/null
+++ b/Task2/Client/.idea/description.html
@@ -0,0 +1,2 @@
+Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
+
\ No newline at end of file
diff --git a/Task2/Client/.idea/encodings.xml b/Task2/Client/.idea/encodings.xml
new file mode 100644
index 0000000..89d0f2f
--- /dev/null
+++ b/Task2/Client/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Client/.idea/gradle.xml b/Task2/Client/.idea/gradle.xml
new file mode 100644
index 0000000..3e3960b
--- /dev/null
+++ b/Task2/Client/.idea/gradle.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Client/.idea/misc.xml b/Task2/Client/.idea/misc.xml
new file mode 100644
index 0000000..365b68a
--- /dev/null
+++ b/Task2/Client/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Client/.idea/modules.xml b/Task2/Client/.idea/modules.xml
new file mode 100644
index 0000000..b7ec2d4
--- /dev/null
+++ b/Task2/Client/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Client/.idea/uiDesigner.xml b/Task2/Client/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/Task2/Client/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/Task2/Client/.idea/vcs.xml b/Task2/Client/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/Task2/Client/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Task2/Client/.idea/workspace.xml b/Task2/Client/.idea/workspace.xml
new file mode 100644
index 0000000..0ae6805
--- /dev/null
+++ b/Task2/Client/.idea/workspace.xml
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1359379246138
+
+
+ 1359379246138
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Client/Client.iml b/Task2/Client/Client.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Task2/Client/Client.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task2/Client/out/artifacts/Client_jar/Client.jar b/Task2/Client/out/artifacts/Client_jar/Client.jar
new file mode 100644
index 0000000..ca07c30
Binary files /dev/null and b/Task2/Client/out/artifacts/Client_jar/Client.jar differ
diff --git a/Task2/Client/out/production/Client/META-INF/MANIFEST.MF b/Task2/Client/out/production/Client/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task2/Client/out/production/Client/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task2/Client/out/production/Client/sample/Client.class b/Task2/Client/out/production/Client/sample/Client.class
new file mode 100644
index 0000000..7b2c865
Binary files /dev/null and b/Task2/Client/out/production/Client/sample/Client.class differ
diff --git a/Task2/Client/out/production/Client/sample/Controller.class b/Task2/Client/out/production/Client/sample/Controller.class
new file mode 100644
index 0000000..2c80520
Binary files /dev/null and b/Task2/Client/out/production/Client/sample/Controller.class differ
diff --git a/Task2/Client/out/production/Client/sample/Main.class b/Task2/Client/out/production/Client/sample/Main.class
new file mode 100644
index 0000000..ef466a1
Binary files /dev/null and b/Task2/Client/out/production/Client/sample/Main.class differ
diff --git a/Task2/Client/out/production/Client/sample/sample.fxml b/Task2/Client/out/production/Client/sample/sample.fxml
new file mode 100644
index 0000000..a78923c
--- /dev/null
+++ b/Task2/Client/out/production/Client/sample/sample.fxml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task2/Client/out/production/Client/sample/wisdom.jpg b/Task2/Client/out/production/Client/sample/wisdom.jpg
new file mode 100644
index 0000000..9289dc7
Binary files /dev/null and b/Task2/Client/out/production/Client/sample/wisdom.jpg differ
diff --git a/Task2/Client/src/META-INF/MANIFEST.MF b/Task2/Client/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task2/Client/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task2/Client/src/sample/Client.java b/Task2/Client/src/sample/Client.java
new file mode 100644
index 0000000..8281872
--- /dev/null
+++ b/Task2/Client/src/sample/Client.java
@@ -0,0 +1,37 @@
+package sample;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Socket;
+
+public class Client{
+ private final String ip;
+ private final int port;
+ private Socket server;
+
+ public Client(String ip, int port) {
+ this.ip = ip;
+ this.port = port;
+ }
+
+ public void start() {
+ try {
+ server = new Socket(ip, port);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getWisdom(){
+ BufferedReader in = null;
+ String wisdom = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(server.getInputStream()));
+ wisdom = in.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return wisdom;
+ }
+}
\ No newline at end of file
diff --git a/Task2/Client/src/sample/Controller.java b/Task2/Client/src/sample/Controller.java
new file mode 100644
index 0000000..a48bf6d
--- /dev/null
+++ b/Task2/Client/src/sample/Controller.java
@@ -0,0 +1,31 @@
+package sample;
+
+import javafx.application.Platform;
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.control.Label;
+
+public class Controller{
+ @FXML
+ Button btnConnect;
+ @FXML
+ Label wisdom;
+ private Client client;
+
+
+ @FXML
+ public void connect(){
+ client = new Client("127.0.0.1", 1234);
+ client.start();
+ new Thread(()->{
+ while (true){
+ getWisdom();}
+ }).start();
+
+ }
+
+ public void getWisdom(){
+ String wisdom = client.getWisdom();
+ Platform.runLater(() -> this.wisdom.setText(wisdom));
+ }
+}
diff --git a/Task2/Client/src/sample/Main.java b/Task2/Client/src/sample/Main.java
new file mode 100644
index 0000000..8f8c06e
--- /dev/null
+++ b/Task2/Client/src/sample/Main.java
@@ -0,0 +1,23 @@
+package sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
+ primaryStage.setTitle("Wisdom");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Task2/Client/src/sample/sample.fxml b/Task2/Client/src/sample/sample.fxml
new file mode 100644
index 0000000..a78923c
--- /dev/null
+++ b/Task2/Client/src/sample/sample.fxml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task2/Client/src/sample/wisdom.jpg b/Task2/Client/src/sample/wisdom.jpg
new file mode 100644
index 0000000..9289dc7
Binary files /dev/null and b/Task2/Client/src/sample/wisdom.jpg differ
diff --git a/Task2/Server/.idea/artifacts/Server_jar.xml b/Task2/Server/.idea/artifacts/Server_jar.xml
new file mode 100644
index 0000000..b5eb72a
--- /dev/null
+++ b/Task2/Server/.idea/artifacts/Server_jar.xml
@@ -0,0 +1,12 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Server_jar
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Server/.idea/compiler.xml b/Task2/Server/.idea/compiler.xml
new file mode 100644
index 0000000..203afe7
--- /dev/null
+++ b/Task2/Server/.idea/compiler.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Server/.idea/misc.xml b/Task2/Server/.idea/misc.xml
new file mode 100644
index 0000000..628b248
--- /dev/null
+++ b/Task2/Server/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Server/.idea/workspace.xml b/Task2/Server/.idea/workspace.xml
new file mode 100644
index 0000000..2c77161
--- /dev/null
+++ b/Task2/Server/.idea/workspace.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1593273851240
+
+
+ 1593273851240
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task2/Server/Server.iml b/Task2/Server/Server.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/Task2/Server/Server.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/Task2/Server/out/artifacts/Server_jar/Server.jar b/Task2/Server/out/artifacts/Server_jar/Server.jar
new file mode 100644
index 0000000..aee87b3
Binary files /dev/null and b/Task2/Server/out/artifacts/Server_jar/Server.jar differ
diff --git a/Task2/Server/pom.xml b/Task2/Server/pom.xml
new file mode 100644
index 0000000..0eb1cd1
--- /dev/null
+++ b/Task2/Server/pom.xml
@@ -0,0 +1,12 @@
+
+
+ 4.0.0
+
+ org.example
+ Server
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/Task2/Server/src/META-INF/MANIFEST.MF b/Task2/Server/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..25b46ff
--- /dev/null
+++ b/Task2/Server/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Server
+
diff --git a/Task2/Server/src/main/java/Server.java b/Task2/Server/src/main/java/Server.java
new file mode 100644
index 0000000..664c385
--- /dev/null
+++ b/Task2/Server/src/main/java/Server.java
@@ -0,0 +1,22 @@
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class Server {
+ private static final int PORT = 1234;
+
+ public static void main(String[] args) throws IOException {
+ ServerSocket serverSocket = new ServerSocket(PORT);
+ System.out.println(" ");
+ try{
+ while(true){
+ Socket socket = serverSocket.accept();
+ System.out.println(" ");
+ new ServerOne(socket);
+ }
+ }
+ finally {
+ serverSocket.close();
+ }
+ }
+}
diff --git a/Task2/Server/src/main/java/ServerOne.java b/Task2/Server/src/main/java/ServerOne.java
new file mode 100644
index 0000000..8c1e91f
--- /dev/null
+++ b/Task2/Server/src/main/java/ServerOne.java
@@ -0,0 +1,84 @@
+import java.io.*;
+import java.net.Socket;
+
+public class ServerOne extends Thread{
+ private Socket socket;
+ private PrintWriter out;
+
+ public ServerOne(Socket s) throws IOException {
+ socket = s;
+ out = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(socket.getOutputStream())), true);
+ start();
+ }
+
+ public void run(){
+ String wisdom = getWisdom();
+ out.println(wisdom);
+ }
+
+ public synchronized String getWisdom(){
+ String randomLine = null;
+ int fileSize = getFileSize("wisdom.txt");
+ int random = 1+(int)(Math.random()*fileSize);
+ System.out.println("random:" + random);
+ InputStream in = this.getClass().getResourceAsStream("wisdom.txt");
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+ for(int i = 0; i < random; ++i) {
+ try {
+ reader.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ try {
+ randomLine = reader.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return randomLine;
+ }
+
+ public synchronized int getFileSize(String name){
+ File file = getResourceAsFile(name);
+ int lineCount = 0;
+ try {
+ FileReader fileReader = new FileReader(file);
+ LineNumberReader lnr = new LineNumberReader(fileReader);
+ while(null!=lnr.readLine()) {
+ lineCount++;
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ System.out.println("LineCount: " + lineCount);
+ return lineCount;
+ }
+
+ public File getResourceAsFile(String name) {
+ try {
+ InputStream inStream = ClassLoader.getSystemClassLoader()
+ .getResourceAsStream(name);
+ if (inStream == null) {
+ return null;
+ }
+ File tempFile = File.createTempFile(String.valueOf(inStream.hashCode()), ".tmp");
+ tempFile.deleteOnExit();
+
+ try (FileOutputStream outStream = new FileOutputStream(tempFile)) {
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inStream.read(buffer)) != -1) {
+ outStream.write(buffer, 0, bytesRead);
+ }
+ }
+ return tempFile;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+}
diff --git a/Task2/Server/src/main/resources/wisdom.txt b/Task2/Server/src/main/resources/wisdom.txt
new file mode 100644
index 0000000..cfa6dff
--- /dev/null
+++ b/Task2/Server/src/main/resources/wisdom.txt
@@ -0,0 +1,164 @@
+ - , , - . ( )
+ , . ( )
+ - @. ( )
+ , . ( )
+ - @. ( )
+ , , , . (GreeveX)
+ 10 , , 20 , ( , ), . (GreeveX)
+ , - , - . (Fobos (new_russian_man))
+ , . ( )
+ , . ( )
+ - , . ( )
+ , , . ( )
+ : . ( )
+ , . ( )
+ : , . ( )
+ . ( )
+ , - . ( )
+ , , . ( )
+ 9-00 , , . ( )
+ - . ( )
+ 6 , . ( )
+ . ( )
+ , . ( )
+ - , . ( )
+ : , , -. ( )
+ , , , . ( )
+ , . ( )
+ . ( )
+ : ( )
+ , , .
+, . ( )
+ - , . ( )
+ - . , . ( )
+ . ( )
+ , - . (..)
+, "" "". (..)
+ - , , ; , ; , - ; , . (..)
+ : . (..)
+ . , , ? (..)
+ , . (..)
+ . (..)
+ . (..)
+ - : " ". (..)
+, , : . (..)
+ : , , . . (..)
+ , . (..)
+ , ( ) . ? , , ? (..)
+ . , . (..)
+ , , - . (..)
+ 10 , , - . (..)
+ - , . (..)
+ . (..)
+, 100 , 10 - 10 . (..)
+ , . (, , , ..) , . (..)
+ , . (..)
+ " " - , . (..)
+ . (..)
+ , , . (..)
+ . (..)
+ , "" . , , , .
+ . (..)
+ , , . (..)
+ - : " , , ", - . (..)
+ . ? (..)
+ - . (..)
+ . . . . (..)
+ , , , , . (..)
+ . (..)
+ . (..)
+ , . (..)
+ , , . (..)
+ , "" , . (..)
+ , . (..)
+ , . (..)
+ - . , . (..)
+ , . (..)
+ , . (..)
+ , , . (..)
+ . (..)
+ : , , , . (..)
+ , . (..)
+ , . (..)
+, - - , . (..)
+ . , , . (..)
+ , . (..)
+ , . : . (..)
+ , , . (..)
+ , . (..)
+ - . (..)
+ , "", - , - .
+ . (..)
+ , , . (..)
+ - : " , , ", - . (..)
+ . ? (..)
+ - . (..)
+ . . . . (..)
+ , , , , . (..)
+ . (..)
+ . (..)
+ , . (..)
+ , , . (..)
+ , "" , . (..)
+ , . (..)
+ , . (..)
+ - . , . (..)
+ , . (..)
+ , . (..)
+ , , . (..)
+ . (..)
+ : , , , . (..)
+ , . (..)
+ , . (..)
+, - - , . (..)
+ . , , . (..)
+ , . (..)
+ , . : . (..)
+ , , . (..)
+ , . (..)
+ - . (..)
+ , "", - , - .
+ " , ". (..)
+ - , . (..)
+ , , , . (..)
+ , . (..)
+ , , . (..)
+ - .
+ " ". (..)
+ - , . (..)
+ : . (..)
+ , . (..)
+ : "" " " - . (..)
+ ( ) : . (..)
+ , ; , ; , ? (..)
+ : " , ". (..)
+ - , . (..)
+ , , , . (..)
+ . (..)
+ ? - ? (..)
+ , . (..)
+ : , . ( ) . (..)
+ , . (..)
+ L, . (..)
+ - . (..)
+ -. (..)
+ - , . (..)
+ ! 100 "" 1 .. (..)
+ : 10 . - 10 . (..)
+ , . (..)
+ , , . (..)
+- , . (..)
+ . ( LIIV LIL). (..)
+ , . , . (..)
+ - "". (..)
+ : , . (..)
+ , , . - . (..)
+ . (..)
+ , , . (..)
+ , . (..)
+ . , , , , . (..)
+ -, , , . (..)
+ , . (..)
+ , , - . (..)
+ , " ": . (..)
+ . (..)
\ No newline at end of file
diff --git a/Task2/Server/target/classes/Server.class b/Task2/Server/target/classes/Server.class
new file mode 100644
index 0000000..c295ab8
Binary files /dev/null and b/Task2/Server/target/classes/Server.class differ
diff --git a/Task2/Server/target/classes/ServerOne.class b/Task2/Server/target/classes/ServerOne.class
new file mode 100644
index 0000000..8067e9d
Binary files /dev/null and b/Task2/Server/target/classes/ServerOne.class differ
diff --git a/Task2/Server/target/classes/wisdom.txt b/Task2/Server/target/classes/wisdom.txt
new file mode 100644
index 0000000..cfa6dff
--- /dev/null
+++ b/Task2/Server/target/classes/wisdom.txt
@@ -0,0 +1,164 @@
+ - , , - . ( )
+ , . ( )
+ - @. ( )
+ , . ( )
+ - @. ( )
+ , , , . (GreeveX)
+ 10 , , 20 , ( , ), . (GreeveX)
+ , - , - . (Fobos (new_russian_man))
+ , . ( )
+ , . ( )
+ - , . ( )
+ , , . ( )
+ : . ( )
+ , . ( )
+ : , . ( )
+ . ( )
+ , - . ( )
+ , , . ( )
+ 9-00 , , . ( )
+ - . ( )
+ 6 , . ( )
+ . ( )
+ , . ( )
+ - , . ( )
+ : , , -. ( )
+ , , , . ( )
+ , . ( )
+ . ( )
+ : ( )
+ , , .
+, . ( )
+ - , . ( )
+ - . , . ( )
+ . ( )
+ , - . (..)
+, "" "". (..)
+ - , , ; , ; , - ; , . (..)
+ : . (..)
+ . , , ? (..)
+ , . (..)
+ . (..)
+ . (..)
+ - : " ". (..)
+, , : . (..)
+ : , , . . (..)
+ , . (..)
+ , ( ) . ? , , ? (..)
+ . , . (..)
+ , , - . (..)
+ 10 , , - . (..)
+ - , . (..)
+ . (..)
+, 100 , 10 - 10 . (..)
+ , . (, , , ..) , . (..)
+ , . (..)
+ " " - , . (..)
+ . (..)
+ , , . (..)
+ . (..)
+ , "" . , , , .
+ . (..)
+ , , . (..)
+ - : " , , ", - . (..)
+ . ? (..)
+ - . (..)
+ . . . . (..)
+ , , , , . (..)
+ . (..)
+ . (..)
+ , . (..)
+ , , . (..)
+ , "" , . (..)
+ , . (..)
+ , . (..)
+ - . , . (..)
+ , . (..)
+ , . (..)
+ , , . (..)
+ . (..)
+ : , , , . (..)
+ , . (..)
+ , . (..)
+, - - , . (..)
+ . , , . (..)
+ , . (..)
+ , . : . (..)
+ , , . (..)
+ , . (..)
+ - . (..)
+ , "", - , - .
+ . (..)
+ , , . (..)
+ - : " , , ", - . (..)
+ . ? (..)
+ - . (..)
+ . . . . (..)
+ , , , , . (..)
+ . (..)
+ . (..)
+ , . (..)
+ , , . (..)
+ , "" , . (..)
+ , . (..)
+ , . (..)
+ - . , . (..)
+ , . (..)
+ , . (..)
+ , , . (..)
+ . (..)
+ : , , , . (..)
+ , . (..)
+ , . (..)
+, - - , . (..)
+ . , , . (..)
+ , . (..)
+ , . : . (..)
+ , , . (..)
+ , . (..)
+ - . (..)
+ , "", - , - .
+ " , ". (..)
+ - , . (..)
+ , , , . (..)
+ , . (..)
+ , , . (..)
+ - .
+ " ". (..)
+ - , . (..)
+ : . (..)
+ , . (..)
+ : "" " " - . (..)
+ ( ) : . (..)
+ , ; , ; , ? (..)
+ : " , ". (..)
+ - , . (..)
+ , , , . (..)
+ . (..)
+ ? - ? (..)
+ , . (..)
+ : , . ( ) . (..)
+ , . (..)
+ L, . (..)
+ - . (..)
+ -. (..)
+ - , . (..)
+ ! 100 "" 1 .. (..)
+ : 10 . - 10 . (..)
+ , . (..)
+ , , . (..)
+- , . (..)
+ . ( LIIV LIL). (..)
+ , . , . (..)
+ - "". (..)
+ : , . (..)
+ , , . - . (..)
+ . (..)
+ , , . (..)
+ , . (..)
+ . , , , , . (..)
+ -, , , . (..)
+ , . (..)
+ , , - . (..)
+ , " ": . (..)
+ . (..)
\ No newline at end of file
diff --git a/Task3/Client/.idea/artifacts/Client_jar.xml b/Task3/Client/.idea/artifacts/Client_jar.xml
new file mode 100644
index 0000000..89756dc
--- /dev/null
+++ b/Task3/Client/.idea/artifacts/Client_jar.xml
@@ -0,0 +1,9 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Client_jar
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Client/.idea/compiler.xml b/Task3/Client/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/Task3/Client/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task3/Client/.idea/description.html b/Task3/Client/.idea/description.html
new file mode 100644
index 0000000..cc10d56
--- /dev/null
+++ b/Task3/Client/.idea/description.html
@@ -0,0 +1,2 @@
+Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
+
\ No newline at end of file
diff --git a/Task3/Client/.idea/encodings.xml b/Task3/Client/.idea/encodings.xml
new file mode 100644
index 0000000..89d0f2f
--- /dev/null
+++ b/Task3/Client/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Client/.idea/gradle.xml b/Task3/Client/.idea/gradle.xml
new file mode 100644
index 0000000..3e3960b
--- /dev/null
+++ b/Task3/Client/.idea/gradle.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Client/.idea/misc.xml b/Task3/Client/.idea/misc.xml
new file mode 100644
index 0000000..365b68a
--- /dev/null
+++ b/Task3/Client/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Client/.idea/modules.xml b/Task3/Client/.idea/modules.xml
new file mode 100644
index 0000000..b7ec2d4
--- /dev/null
+++ b/Task3/Client/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Client/.idea/uiDesigner.xml b/Task3/Client/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/Task3/Client/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/Task3/Client/.idea/vcs.xml b/Task3/Client/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/Task3/Client/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Task3/Client/.idea/workspace.xml b/Task3/Client/.idea/workspace.xml
new file mode 100644
index 0000000..4b0bfda
--- /dev/null
+++ b/Task3/Client/.idea/workspace.xml
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1359379246138
+
+
+ 1359379246138
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Client/Client.iml b/Task3/Client/Client.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Task3/Client/Client.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task3/Client/out/artifacts/Client_jar/Client.jar b/Task3/Client/out/artifacts/Client_jar/Client.jar
new file mode 100644
index 0000000..1912397
Binary files /dev/null and b/Task3/Client/out/artifacts/Client_jar/Client.jar differ
diff --git a/Task3/Client/out/production/Client/META-INF/MANIFEST.MF b/Task3/Client/out/production/Client/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task3/Client/out/production/Client/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task3/Client/out/production/Client/sample/Client.class b/Task3/Client/out/production/Client/sample/Client.class
new file mode 100644
index 0000000..e1bcf97
Binary files /dev/null and b/Task3/Client/out/production/Client/sample/Client.class differ
diff --git a/Task3/Client/out/production/Client/sample/Controller.class b/Task3/Client/out/production/Client/sample/Controller.class
new file mode 100644
index 0000000..1d3cb48
Binary files /dev/null and b/Task3/Client/out/production/Client/sample/Controller.class differ
diff --git a/Task3/Client/out/production/Client/sample/Main.class b/Task3/Client/out/production/Client/sample/Main.class
new file mode 100644
index 0000000..4d7f092
Binary files /dev/null and b/Task3/Client/out/production/Client/sample/Main.class differ
diff --git a/Task3/Client/out/production/Client/sample/planner.jpg b/Task3/Client/out/production/Client/sample/planner.jpg
new file mode 100644
index 0000000..e5a3d19
Binary files /dev/null and b/Task3/Client/out/production/Client/sample/planner.jpg differ
diff --git a/Task3/Client/out/production/Client/sample/sample.fxml b/Task3/Client/out/production/Client/sample/sample.fxml
new file mode 100644
index 0000000..3f43bd1
--- /dev/null
+++ b/Task3/Client/out/production/Client/sample/sample.fxml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task3/Client/src/META-INF/MANIFEST.MF b/Task3/Client/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task3/Client/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task3/Client/src/sample/Client.java b/Task3/Client/src/sample/Client.java
new file mode 100644
index 0000000..9b2f10e
--- /dev/null
+++ b/Task3/Client/src/sample/Client.java
@@ -0,0 +1,40 @@
+package sample;
+
+import javax.print.event.PrintEvent;
+import java.io.*;
+import java.net.Socket;
+
+public class Client{
+ private final String ip;
+ private final int port;
+ private Socket server;
+ BufferedReader in;
+ PrintWriter out;
+
+
+ public Client(String ip, int port, int id) {
+ this.ip = ip;
+ this.port = port;
+ }
+
+ public void start(int id) {
+ try {
+ server = new Socket(ip, port);
+ out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(server.getOutputStream())), true);
+ out.println(id);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getMessage(){
+ String message = "";
+ try {
+ in = new BufferedReader(new InputStreamReader(server.getInputStream()));
+ message = in.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return message;
+ }
+}
\ No newline at end of file
diff --git a/Task3/Client/src/sample/Controller.java b/Task3/Client/src/sample/Controller.java
new file mode 100644
index 0000000..bbd8271
--- /dev/null
+++ b/Task3/Client/src/sample/Controller.java
@@ -0,0 +1,79 @@
+package sample;
+
+import javafx.application.Platform;
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.ComboBox;
+import javafx.scene.control.Label;
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.ResourceBundle;
+
+
+public class Controller implements Initializable{
+ @FXML
+ private Label lblDateTime;
+ @FXML
+ private Label lblMessage;
+ @FXML
+ private ComboBox cbId;
+ private Client client;
+ private int id;
+
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+ setComboBox();
+ }
+
+ public void setComboBox(){
+ ObservableList idList = FXCollections.observableArrayList(1,2,3);
+ cbId.setItems(idList);
+ }
+
+ public void getId(){
+ try {
+ id = cbId.getValue();
+ }
+ catch (java.lang.NullPointerException e){};
+ client = new Client("127.0.0.1", 1234, id);
+ client.start(id);
+ new Thread(()->{
+ while (true){
+ getTime();
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }).start();
+ new Thread(()->{
+ while (true){
+ getMessage();
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }}
+ }).start();
+ }
+
+ public void getTime(){
+ DateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
+ Date date = new Date();
+ String time = dateFormat.format(date);
+ Platform.runLater(() -> lblDateTime.setText(time));
+ }
+
+ public void getMessage(){
+ String message = client.getMessage();
+ if(!message.equals("")){
+ Platform.runLater(() -> lblMessage.setText(message));
+ }
+ }
+}
+
diff --git a/Task3/Client/src/sample/Main.java b/Task3/Client/src/sample/Main.java
new file mode 100644
index 0000000..c92f670
--- /dev/null
+++ b/Task3/Client/src/sample/Main.java
@@ -0,0 +1,23 @@
+package sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
+ primaryStage.setTitle("Planner");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Task3/Client/src/sample/planner.jpg b/Task3/Client/src/sample/planner.jpg
new file mode 100644
index 0000000..e5a3d19
Binary files /dev/null and b/Task3/Client/src/sample/planner.jpg differ
diff --git a/Task3/Client/src/sample/sample.fxml b/Task3/Client/src/sample/sample.fxml
new file mode 100644
index 0000000..3f43bd1
--- /dev/null
+++ b/Task3/Client/src/sample/sample.fxml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task3/Server/.idea/artifacts/Server_jar.xml b/Task3/Server/.idea/artifacts/Server_jar.xml
new file mode 100644
index 0000000..3559ca4
--- /dev/null
+++ b/Task3/Server/.idea/artifacts/Server_jar.xml
@@ -0,0 +1,15 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Server_jar
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Server/.idea/compiler.xml b/Task3/Server/.idea/compiler.xml
new file mode 100644
index 0000000..203afe7
--- /dev/null
+++ b/Task3/Server/.idea/compiler.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Server/.idea/misc.xml b/Task3/Server/.idea/misc.xml
new file mode 100644
index 0000000..628b248
--- /dev/null
+++ b/Task3/Server/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Server/.idea/workspace.xml b/Task3/Server/.idea/workspace.xml
new file mode 100644
index 0000000..4a05867
--- /dev/null
+++ b/Task3/Server/.idea/workspace.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1593336732875
+
+
+ 1593336732875
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Server/Server.iml b/Task3/Server/Server.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/Task3/Server/Server.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/Task3/Server/out/artifacts/Server_jar/Server.jar b/Task3/Server/out/artifacts/Server_jar/Server.jar
new file mode 100644
index 0000000..5c7a0a3
Binary files /dev/null and b/Task3/Server/out/artifacts/Server_jar/Server.jar differ
diff --git a/Task3/Server/pom.xml b/Task3/Server/pom.xml
new file mode 100644
index 0000000..a0ad03f
--- /dev/null
+++ b/Task3/Server/pom.xml
@@ -0,0 +1,20 @@
+
+
+ 4.0.0
+
+ org.example
+ Server
+ 1.0-SNAPSHOT
+
+
+
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1.1
+
+
+
+
\ No newline at end of file
diff --git a/Task3/Server/src/META-INF/MANIFEST.MF b/Task3/Server/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..25b46ff
--- /dev/null
+++ b/Task3/Server/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Server
+
diff --git a/Task3/Server/src/main/java/Message.java b/Task3/Server/src/main/java/Message.java
new file mode 100644
index 0000000..a6b731c
--- /dev/null
+++ b/Task3/Server/src/main/java/Message.java
@@ -0,0 +1,36 @@
+import java.util.Date;
+
+public class Message {
+ private long id;
+ private String time;
+ private String message;
+ public Message(long id, String time, String message) {
+ this.id = id;
+ this.time = time;
+ this.message = message;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public void setTime(String time) {
+ this.time = time;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/Task3/Server/src/main/java/Server.java b/Task3/Server/src/main/java/Server.java
new file mode 100644
index 0000000..2ef406f
--- /dev/null
+++ b/Task3/Server/src/main/java/Server.java
@@ -0,0 +1,22 @@
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class Server {
+ private static final int PORT = 1234;
+
+ public static void main(String[] args) throws IOException {
+ ServerSocket serverSocket = new ServerSocket(PORT);
+ System.out.println(" ");
+ try{
+ while(true){
+ Socket socket = serverSocket.accept();
+ System.out.println(" ");
+ new ServerOne(socket);
+ }
+ }
+ finally {
+ serverSocket.close();
+ }
+ }
+}
diff --git a/Task3/Server/src/main/java/ServerOne.java b/Task3/Server/src/main/java/ServerOne.java
new file mode 100644
index 0000000..85930b5
--- /dev/null
+++ b/Task3/Server/src/main/java/ServerOne.java
@@ -0,0 +1,106 @@
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import java.io.*;
+import java.net.Socket;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+public class ServerOne extends Thread{
+ private Socket socket;
+ private PrintWriter out;
+ private BufferedReader in;
+ private List messages = new ArrayList<>();
+
+ public ServerOne(Socket s) throws IOException {
+ socket = s;
+ in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ out = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(socket.getOutputStream())), true);
+ start();
+ }
+
+ public void run(){
+ try {
+ long id = Long.parseLong(in.readLine());
+ System.out.println("id: " + id);
+ int count = 0;
+ makeMessages();
+ while (true) {
+ for (Message message : messages) {
+ if (id == message.getId()) {
+ count++;
+ DateFormat dateFormat = new SimpleDateFormat("HH:mm");
+ Date now = new Date();
+ String dateNow = dateFormat.format(now);
+ if (message.getTime().equals(dateNow)) {
+ out.println(message.getMessage());
+ }
+ }
+ }
+ if(count==0) {
+ out.println(" ");
+ break;
+ }
+ }
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void makeMessages(){
+ File file = getResourceAsFile("messages.json");
+ long id;
+ Date date;
+ String msg;
+ JSONParser parser = new JSONParser();
+ try {
+ Object obj = parser.parse(new FileReader(file));
+ JSONObject jsonObject = (JSONObject) obj;
+ JSONArray JSONmessages = (JSONArray) jsonObject.get("messages");
+ for(int i = 0 ; i< JSONmessages.size() ;i++){
+ JSONObject object = (JSONObject) JSONmessages.get(i);
+ id = (long) object.get("id");
+ String time = (String) object.get("time");
+ msg = (String) object.get("message");
+ Message message = new Message(id, time, msg);
+ messages.add(message);
+ }
+ } catch (ParseException e) {
+ e.printStackTrace();
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public File getResourceAsFile(String name) {
+ try {
+ InputStream inStream = ClassLoader.getSystemClassLoader()
+ .getResourceAsStream(name);
+ if (inStream == null) {
+ return null;
+ }
+ File tempFile = File.createTempFile(String.valueOf(inStream.hashCode()), ".tmp");
+ tempFile.deleteOnExit();
+
+ try (FileOutputStream outStream = new FileOutputStream(tempFile)) {
+ byte[] buffer = new byte[1024];
+ int bytesRead;
+ while ((bytesRead = inStream.read(buffer)) != -1) {
+ outStream.write(buffer, 0, bytesRead);
+ }
+ }
+ return tempFile;
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+}
diff --git a/Task3/Server/src/main/resources/messages.json b/Task3/Server/src/main/resources/messages.json
new file mode 100644
index 0000000..3277e97
--- /dev/null
+++ b/Task3/Server/src/main/resources/messages.json
@@ -0,0 +1,49 @@
+{
+ "messages": [
+ {
+ "id": 1,
+ "time": "09:00",
+ "message": ""
+ },
+ {
+ "id": 1,
+ "time": "13:00",
+ "message": " "
+ },
+ {
+ "id": 1,
+ "time": "17:00",
+ "message": " "
+ },
+ {
+ "id": 1,
+ "time": "18:00",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "10:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "12:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "13:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "15:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "16:30",
+ "message": " "
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Task3/Server/target/classes/Message.class b/Task3/Server/target/classes/Message.class
new file mode 100644
index 0000000..b8fde97
Binary files /dev/null and b/Task3/Server/target/classes/Message.class differ
diff --git a/Task3/Server/target/classes/Server.class b/Task3/Server/target/classes/Server.class
new file mode 100644
index 0000000..5a51b95
Binary files /dev/null and b/Task3/Server/target/classes/Server.class differ
diff --git a/Task3/Server/target/classes/ServerOne.class b/Task3/Server/target/classes/ServerOne.class
new file mode 100644
index 0000000..f333731
Binary files /dev/null and b/Task3/Server/target/classes/ServerOne.class differ
diff --git a/Task3/Server/target/classes/messages.json b/Task3/Server/target/classes/messages.json
new file mode 100644
index 0000000..3277e97
--- /dev/null
+++ b/Task3/Server/target/classes/messages.json
@@ -0,0 +1,49 @@
+{
+ "messages": [
+ {
+ "id": 1,
+ "time": "09:00",
+ "message": ""
+ },
+ {
+ "id": 1,
+ "time": "13:00",
+ "message": " "
+ },
+ {
+ "id": 1,
+ "time": "17:00",
+ "message": " "
+ },
+ {
+ "id": 1,
+ "time": "18:00",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "10:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "12:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "13:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "15:30",
+ "message": " "
+ },
+ {
+ "id": 2,
+ "time": "16:30",
+ "message": " "
+ }
+ ]
+}
\ No newline at end of file
diff --git a/Task4/.idea/artifacts/Task4_jar.xml b/Task4/.idea/artifacts/Task4_jar.xml
new file mode 100644
index 0000000..fe9e302
--- /dev/null
+++ b/Task4/.idea/artifacts/Task4_jar.xml
@@ -0,0 +1,9 @@
+
+
+ $PROJECT_DIR$/out/artifacts/Task4_jar
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task4/.idea/compiler.xml b/Task4/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/Task4/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task4/.idea/description.html b/Task4/.idea/description.html
new file mode 100644
index 0000000..cc10d56
--- /dev/null
+++ b/Task4/.idea/description.html
@@ -0,0 +1,2 @@
+Simple JavaFX 2.0 application that includes simple .fxml file with attached controller and Main class to quick start. Artifact to build JavaFX application is provided.
+
\ No newline at end of file
diff --git a/Task4/.idea/encodings.xml b/Task4/.idea/encodings.xml
new file mode 100644
index 0000000..89d0f2f
--- /dev/null
+++ b/Task4/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task4/.idea/gradle.xml b/Task4/.idea/gradle.xml
new file mode 100644
index 0000000..3e3960b
--- /dev/null
+++ b/Task4/.idea/gradle.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Task4/.idea/misc.xml b/Task4/.idea/misc.xml
new file mode 100644
index 0000000..365b68a
--- /dev/null
+++ b/Task4/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task4/.idea/modules.xml b/Task4/.idea/modules.xml
new file mode 100644
index 0000000..8abcf7c
--- /dev/null
+++ b/Task4/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task4/.idea/uiDesigner.xml b/Task4/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/Task4/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/Task4/.idea/vcs.xml b/Task4/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/Task4/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Task4/.idea/workspace.xml b/Task4/.idea/workspace.xml
new file mode 100644
index 0000000..880c74f
--- /dev/null
+++ b/Task4/.idea/workspace.xml
@@ -0,0 +1,256 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1359379246138
+
+
+ 1359379246138
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Task4/Task4.iml b/Task4/Task4.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Task4/Task4.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task4/out/artifacts/Task4_jar/Task4.jar b/Task4/out/artifacts/Task4_jar/Task4.jar
new file mode 100644
index 0000000..9d4c198
Binary files /dev/null and b/Task4/out/artifacts/Task4_jar/Task4.jar differ
diff --git a/Task4/out/production/Task4/META-INF/MANIFEST.MF b/Task4/out/production/Task4/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task4/out/production/Task4/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task4/out/production/Task4/sample/Client.class b/Task4/out/production/Task4/sample/Client.class
new file mode 100644
index 0000000..fe37c76
Binary files /dev/null and b/Task4/out/production/Task4/sample/Client.class differ
diff --git a/Task4/out/production/Task4/sample/Controller.class b/Task4/out/production/Task4/sample/Controller.class
new file mode 100644
index 0000000..1556221
Binary files /dev/null and b/Task4/out/production/Task4/sample/Controller.class differ
diff --git a/Task4/out/production/Task4/sample/Main.class b/Task4/out/production/Task4/sample/Main.class
new file mode 100644
index 0000000..869c1a8
Binary files /dev/null and b/Task4/out/production/Task4/sample/Main.class differ
diff --git a/Task4/out/production/Task4/sample/pic.jpg b/Task4/out/production/Task4/sample/pic.jpg
new file mode 100644
index 0000000..ad96323
Binary files /dev/null and b/Task4/out/production/Task4/sample/pic.jpg differ
diff --git a/Task4/out/production/Task4/sample/sample.fxml b/Task4/out/production/Task4/sample/sample.fxml
new file mode 100644
index 0000000..1addc4e
--- /dev/null
+++ b/Task4/out/production/Task4/sample/sample.fxml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Task4/src/META-INF/MANIFEST.MF b/Task4/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Task4/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Task4/src/sample/Client.java b/Task4/src/sample/Client.java
new file mode 100644
index 0000000..1093ff0
--- /dev/null
+++ b/Task4/src/sample/Client.java
@@ -0,0 +1,70 @@
+package sample;
+
+import javafx.scene.image.Image;
+
+import java.io.*;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+public class Client {
+ private Socket socket = new Socket();
+ private String host = "www.catsthatlooklikehitler.com";
+ private PrintWriter out = null;
+ private BufferedReader in = null;
+ private String name;
+ private String owner;
+ private String time;
+ private String date;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getOwner() {
+ return owner;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void connect(){
+ try {
+ socket.connect(new InetSocketAddress(host, 80));
+ System.out.println(" !");
+ out = new PrintWriter(socket.getOutputStream(), true);
+ in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void getResponse(){
+ String request = "GET http://www.catsthatlooklikehitler.com/cgi-bin/seigmiaow.pl? HTTP/1.0\r\n\r\n";
+ String response="";
+ String newLine = "";
+ out.println(request);
+ System.out.println(" ");
+ try {
+ while (newLine!=null){
+ newLine = in.readLine();
+ if(newLine.contains("owned by")) {
+ response += newLine;
+ break;
+ }
+ }
+ name = response.replaceAll("^.*
(.*) \\(owned.*$", "$1");
+ owner = response.replaceAll("^.*owned by (.*)\\).*\\).*$", "$1");
+ time = response.replaceAll(".*at (.*)$", "$1");
+ date = response.replaceAll(".*>(.*) at.*$", "$1");
+
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/Task4/src/sample/Controller.java b/Task4/src/sample/Controller.java
new file mode 100644
index 0000000..d725de6
--- /dev/null
+++ b/Task4/src/sample/Controller.java
@@ -0,0 +1,36 @@
+package sample;
+
+import javafx.fxml.FXML;
+import javafx.fxml.Initializable;
+import javafx.scene.control.Hyperlink;
+import javafx.scene.control.Label;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.net.URL;
+import java.util.ResourceBundle;
+
+public class Controller implements Initializable {
+ private Client client;
+ @FXML
+ Label lblName;
+ @FXML
+ Label lblOwner;
+ @FXML
+ Label lblDate;
+ @FXML
+ Label lblTime;
+
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle) {
+ client = new Client();
+ client.connect();
+ client.getResponse();
+ lblName.setText(client.getName());
+ lblOwner.setText(client.getOwner());
+ lblDate.setText(client.getDate());
+ lblTime.setText(client.getTime());
+ }
+}
diff --git a/Task4/src/sample/Main.java b/Task4/src/sample/Main.java
new file mode 100644
index 0000000..0352780
--- /dev/null
+++ b/Task4/src/sample/Main.java
@@ -0,0 +1,23 @@
+package sample;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+
+public class Main extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception{
+ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
+ primaryStage.setTitle("Kitlers");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Task4/src/sample/pic.jpg b/Task4/src/sample/pic.jpg
new file mode 100644
index 0000000..ad96323
Binary files /dev/null and b/Task4/src/sample/pic.jpg differ
diff --git a/Task4/src/sample/sample.fxml b/Task4/src/sample/sample.fxml
new file mode 100644
index 0000000..1addc4e
--- /dev/null
+++ b/Task4/src/sample/sample.fxml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+