diff --git a/Aforizm/AforizmClient/.idea/.gitignore b/Aforizm/AforizmClient/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/Aforizm/AforizmClient/.idea/artifacts/AforizmClient_jar.xml b/Aforizm/AforizmClient/.idea/artifacts/AforizmClient_jar.xml
new file mode 100644
index 0000000..6876050
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/artifacts/AforizmClient_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/AforizmClient_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/.idea/compiler.xml b/Aforizm/AforizmClient/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Aforizm/AforizmClient/.idea/description.html b/Aforizm/AforizmClient/.idea/description.html
new file mode 100644
index 0000000..cc10d56
--- /dev/null
+++ b/Aforizm/AforizmClient/.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/Aforizm/AforizmClient/.idea/encodings.xml b/Aforizm/AforizmClient/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/.idea/gradle.xml b/Aforizm/AforizmClient/.idea/gradle.xml
new file mode 100644
index 0000000..3e3960b
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/gradle.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/.idea/misc.xml b/Aforizm/AforizmClient/.idea/misc.xml
new file mode 100644
index 0000000..4e6e724
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/.idea/modules.xml b/Aforizm/AforizmClient/.idea/modules.xml
new file mode 100644
index 0000000..7a1caf7
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/.idea/uiDesigner.xml b/Aforizm/AforizmClient/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/Aforizm/AforizmClient/.idea/vcs.xml b/Aforizm/AforizmClient/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/Aforizm/AforizmClient/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Aforizm/AforizmClient/AforizmClient.iml b/Aforizm/AforizmClient/AforizmClient.iml
new file mode 100644
index 0000000..5925121
--- /dev/null
+++ b/Aforizm/AforizmClient/AforizmClient.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/AforizmClient.jar b/Aforizm/AforizmClient/AforizmClient.jar
new file mode 100644
index 0000000..f204bb9
Binary files /dev/null and b/Aforizm/AforizmClient/AforizmClient.jar differ
diff --git a/Aforizm/AforizmClient/resource/295.jpg b/Aforizm/AforizmClient/resource/295.jpg
new file mode 100644
index 0000000..50d836d
Binary files /dev/null and b/Aforizm/AforizmClient/resource/295.jpg differ
diff --git a/Aforizm/AforizmClient/resource/sample.fxml b/Aforizm/AforizmClient/resource/sample.fxml
new file mode 100644
index 0000000..a02e1b7
--- /dev/null
+++ b/Aforizm/AforizmClient/resource/sample.fxml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Aforizm/AforizmClient/src/META-INF/MANIFEST.MF b/Aforizm/AforizmClient/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Aforizm/AforizmClient/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Aforizm/AforizmClient/src/sample/Client.java b/Aforizm/AforizmClient/src/sample/Client.java
new file mode 100644
index 0000000..3fba720
--- /dev/null
+++ b/Aforizm/AforizmClient/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 getAforizm(){
+ BufferedReader in = null;
+ String aforizm = null;
+ try {
+ in = new BufferedReader(new InputStreamReader(server.getInputStream()));
+ aforizm = in.readLine();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return aforizm;
+ }
+}
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/src/sample/Controller.java b/Aforizm/AforizmClient/src/sample/Controller.java
new file mode 100644
index 0000000..78a968c
--- /dev/null
+++ b/Aforizm/AforizmClient/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 aforizm;
+ private Client client;
+
+
+ @FXML
+ public void connect(){
+ client = new Client("127.0.0.1", 1234);
+ client.start();
+ new Thread(()->{
+ while (true){
+ getAforizm();}
+ }).start();
+
+ }
+
+ public void getAforizm(){
+ String aforizm = client.getAforizm();
+ Platform.runLater(() -> this.aforizm.setText(aforizm));
+ }
+}
\ No newline at end of file
diff --git a/Aforizm/AforizmClient/src/sample/Main.java b/Aforizm/AforizmClient/src/sample/Main.java
new file mode 100644
index 0000000..a2087f0
--- /dev/null
+++ b/Aforizm/AforizmClient/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("Aforizm");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Aforizm/AforizmServer/.idea/.gitignore b/Aforizm/AforizmServer/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/Aforizm/AforizmServer/.idea/artifacts/AforizmServer_jar.xml b/Aforizm/AforizmServer/.idea/artifacts/AforizmServer_jar.xml
new file mode 100644
index 0000000..5c36c01
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/artifacts/AforizmServer_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/AforizmServer_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/.idea/description.html b/Aforizm/AforizmServer/.idea/description.html
new file mode 100644
index 0000000..db5f129
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/description.html
@@ -0,0 +1 @@
+Simple Java application that includes a class with main() method
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/.idea/encodings.xml b/Aforizm/AforizmServer/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/.idea/misc.xml b/Aforizm/AforizmServer/.idea/misc.xml
new file mode 100644
index 0000000..89e42c1
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/.idea/modules.xml b/Aforizm/AforizmServer/.idea/modules.xml
new file mode 100644
index 0000000..1ab8d7b
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/.idea/project-template.xml b/Aforizm/AforizmServer/.idea/project-template.xml
new file mode 100644
index 0000000..1f08b88
--- /dev/null
+++ b/Aforizm/AforizmServer/.idea/project-template.xml
@@ -0,0 +1,3 @@
+
+ IJ_BASE_PACKAGE
+
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/AforizmServer.iml b/Aforizm/AforizmServer/AforizmServer.iml
new file mode 100644
index 0000000..5925121
--- /dev/null
+++ b/Aforizm/AforizmServer/AforizmServer.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/AforizmServer.jar b/Aforizm/AforizmServer/AforizmServer.jar
new file mode 100644
index 0000000..66a8bc6
Binary files /dev/null and b/Aforizm/AforizmServer/AforizmServer.jar differ
diff --git a/Aforizm/AforizmServer/resource/Aforizms.txt b/Aforizm/AforizmServer/resource/Aforizms.txt
new file mode 100644
index 0000000..2dda890
--- /dev/null
+++ b/Aforizm/AforizmServer/resource/Aforizms.txt
@@ -0,0 +1,31 @@
+The first half of life consists of the capacity to enjoy without the chance, the last half consists of the chance without the capacity. Mark Twain
+While we are postponing, life speeds by. Seneca
+If you do not think about the future, you cannot have one. Galsworthy
+The roots of education are bitter, but the fruit is sweet. Aristotle
+Education is a progressive discovery of our own ignorance. William James "Will" Durant
+Always forgive your enemies; nothing annoys them so much. Oscar Wilde
+I am not young enough to know everything. Oscar Wilde
+A banker is a fellow who lends you his umbrella when the sun is shining, but wants it back the minute it begins to rain. Mark Twain
+It is with our passions, as it is with fire and water, they are good servants but bad masters. Aesop
+The great aim of education is not knowledge but action. Herbert Spencer
+An investment in knowledge always pays the best interest. Benjamin Franklin
+I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals. Sir Winston Churchill
+Abortion is advocated only by persons who have themselves been born. Ronald Reagan
+Own only what you can carry with you; know language, know countries, know people. Let your memory be your travel bag. Alexander Solzhenitsyn
+The very first law in advertising is to avoid the concrete promise and cultivate the delightfully vague. Bill Cosby
+Logic will get you from A to B. Imagination will take you anywhere. Albert Einstein
+Our greatest glory is not in never falling, but in getting up every time we do. Confucius
+Political language is designed to make lies sound truthful and murder respectable and to give an appearance of solidity to pure wind. George Orwell
+Translation is like a woman. If it is beautiful, it is not faithful. If it is faithful, it is most certainly not beautiful. Yevgeny Yevtushenko
+England and America are two countries separated by the same language. George Bernard Shaw
+Adults are just outdated children. Dr. Seuss
+Democracy cannot succeed unless those who express their choice are prepared to choose wisely. The real safeguard of democracy, therefore, is education. Franklin D. Roosevelt
+All that is necessary for the triumph of evil is for good men to do nothing. Edmund Burke
+Applause is the spur of noble minds, the end and aim of weak ones. Edmund Burke
+Bad laws are the worst sort of tyranny. Edmund Burke
+But what is liberty without wisdom, and without virtue? It is the greatest of all possible evils; for it is folly, vice, and madness, without tuition or restraint. Edmund Burke
+Politics, it seems to me, for years, or all too long, has been concerned with right or left instead of right or wrong. Richard Armour
+It is not always the same thing to be a good man and a good citizen. Aristotle
+The only stable state is the one in which all men are equal before the law. Aristotle
+Every nation in every region now has a decision to make. Either you are with us, or you are with the terrorists. George W. Bush
+I've heard the call. I believe God wants me to run for President. George W. Bush
diff --git a/Aforizm/AforizmServer/src/META-INF/MANIFEST.MF b/Aforizm/AforizmServer/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..da80aed
--- /dev/null
+++ b/Aforizm/AforizmServer/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: ServerPath1
+
diff --git a/Aforizm/AforizmServer/src/ServerPath1.java b/Aforizm/AforizmServer/src/ServerPath1.java
new file mode 100644
index 0000000..82e3378
--- /dev/null
+++ b/Aforizm/AforizmServer/src/ServerPath1.java
@@ -0,0 +1,22 @@
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+public class ServerPath1 {
+ private static final int PORT = 1234;
+
+ public static void main(String[] args) throws IOException {
+ ServerSocket serverSocket = new ServerSocket(PORT);
+ System.out.println("New connection");
+ try{
+ while(true){
+ Socket socket = serverSocket.accept();
+ System.out.println("New string");
+ new ServerPath2(socket);
+ }
+ }
+ finally {
+ serverSocket.close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Aforizm/AforizmServer/src/ServerPath2.java b/Aforizm/AforizmServer/src/ServerPath2.java
new file mode 100644
index 0000000..f67a253
--- /dev/null
+++ b/Aforizm/AforizmServer/src/ServerPath2.java
@@ -0,0 +1,84 @@
+import java.io.*;
+import java.net.Socket;
+
+public class ServerPath2 extends Thread{
+ private Socket socket;
+ private PrintWriter out;
+
+ public ServerPath2(Socket s) throws IOException {
+ socket = s;
+ out = new PrintWriter(new BufferedWriter(
+ new OutputStreamWriter(socket.getOutputStream())), true);
+ start();
+ }
+
+ public void run(){
+ String aforizm = getAforizm();
+ out.println(aforizm);
+ }
+
+ public synchronized String getAforizm(){
+ String randomLine = null;
+ int fileSize = getFileSize("Aforizms.txt");
+ int random = 1+(int)(Math.random()*fileSize);
+ System.out.println("random:" + random);
+ InputStream in = this.getClass().getResourceAsStream("Aforizms.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;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Time/ClientTime/.idea/.gitignore b/Time/ClientTime/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/Time/ClientTime/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/Time/ClientTime/.idea/artifacts/ClientTime_jar.xml b/Time/ClientTime/.idea/artifacts/ClientTime_jar.xml
new file mode 100644
index 0000000..d61ebd4
--- /dev/null
+++ b/Time/ClientTime/.idea/artifacts/ClientTime_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/ClientTime_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ClientTime/.idea/compiler.xml b/Time/ClientTime/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/Time/ClientTime/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Time/ClientTime/.idea/description.html b/Time/ClientTime/.idea/description.html
new file mode 100644
index 0000000..cc10d56
--- /dev/null
+++ b/Time/ClientTime/.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/Time/ClientTime/.idea/encodings.xml b/Time/ClientTime/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Time/ClientTime/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ClientTime/.idea/gradle.xml b/Time/ClientTime/.idea/gradle.xml
new file mode 100644
index 0000000..3e3960b
--- /dev/null
+++ b/Time/ClientTime/.idea/gradle.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Time/ClientTime/.idea/misc.xml b/Time/ClientTime/.idea/misc.xml
new file mode 100644
index 0000000..4e6e724
--- /dev/null
+++ b/Time/ClientTime/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ClientTime/.idea/modules.xml b/Time/ClientTime/.idea/modules.xml
new file mode 100644
index 0000000..ea71065
--- /dev/null
+++ b/Time/ClientTime/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ClientTime/.idea/uiDesigner.xml b/Time/ClientTime/.idea/uiDesigner.xml
new file mode 100644
index 0000000..3b00020
--- /dev/null
+++ b/Time/ClientTime/.idea/uiDesigner.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
+
diff --git a/Time/ClientTime/.idea/vcs.xml b/Time/ClientTime/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/Time/ClientTime/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Time/ClientTime/ClientTime.iml b/Time/ClientTime/ClientTime.iml
new file mode 100644
index 0000000..5925121
--- /dev/null
+++ b/Time/ClientTime/ClientTime.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ClientTime/ClientTime.jar b/Time/ClientTime/ClientTime.jar
new file mode 100644
index 0000000..f75f7bb
Binary files /dev/null and b/Time/ClientTime/ClientTime.jar differ
diff --git a/Time/ClientTime/resource/1.jpeg b/Time/ClientTime/resource/1.jpeg
new file mode 100644
index 0000000..daef11e
Binary files /dev/null and b/Time/ClientTime/resource/1.jpeg differ
diff --git a/Time/ClientTime/resource/sample.fxml b/Time/ClientTime/resource/sample.fxml
new file mode 100644
index 0000000..e0fabea
--- /dev/null
+++ b/Time/ClientTime/resource/sample.fxml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Time/ClientTime/src/META-INF/MANIFEST.MF b/Time/ClientTime/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..440fa71
--- /dev/null
+++ b/Time/ClientTime/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: sample.Main
+
diff --git a/Time/ClientTime/src/sample/Client.java b/Time/ClientTime/src/sample/Client.java
new file mode 100644
index 0000000..dc0e05c
--- /dev/null
+++ b/Time/ClientTime/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/Time/ClientTime/src/sample/Controller.java b/Time/ClientTime/src/sample/Controller.java
new file mode 100644
index 0000000..103d34a
--- /dev/null
+++ b/Time/ClientTime/src/sample/Controller.java
@@ -0,0 +1,33 @@
+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", 4321);
+ 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/Time/ClientTime/src/sample/Main.java b/Time/ClientTime/src/sample/Main.java
new file mode 100644
index 0000000..743f246
--- /dev/null
+++ b/Time/ClientTime/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("Date/Clock");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/Time/ServerTime/.idea/.gitignore b/Time/ServerTime/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/Time/ServerTime/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/Time/ServerTime/.idea/artifacts/ServerTime_jar.xml b/Time/ServerTime/.idea/artifacts/ServerTime_jar.xml
new file mode 100644
index 0000000..82b66cb
--- /dev/null
+++ b/Time/ServerTime/.idea/artifacts/ServerTime_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/ServerTime_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ServerTime/.idea/description.html b/Time/ServerTime/.idea/description.html
new file mode 100644
index 0000000..db5f129
--- /dev/null
+++ b/Time/ServerTime/.idea/description.html
@@ -0,0 +1 @@
+Simple Java application that includes a class with main() method
\ No newline at end of file
diff --git a/Time/ServerTime/.idea/encodings.xml b/Time/ServerTime/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/Time/ServerTime/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ServerTime/.idea/misc.xml b/Time/ServerTime/.idea/misc.xml
new file mode 100644
index 0000000..89e42c1
--- /dev/null
+++ b/Time/ServerTime/.idea/misc.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ServerTime/.idea/modules.xml b/Time/ServerTime/.idea/modules.xml
new file mode 100644
index 0000000..4212cdc
--- /dev/null
+++ b/Time/ServerTime/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Time/ServerTime/.idea/project-template.xml b/Time/ServerTime/.idea/project-template.xml
new file mode 100644
index 0000000..1f08b88
--- /dev/null
+++ b/Time/ServerTime/.idea/project-template.xml
@@ -0,0 +1,3 @@
+
+ IJ_BASE_PACKAGE
+
\ No newline at end of file
diff --git a/Time/ServerTime/ServerTime.iml b/Time/ServerTime/ServerTime.iml
new file mode 100644
index 0000000..d5c0743
--- /dev/null
+++ b/Time/ServerTime/ServerTime.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Time/ServerTime/ServerTime.jar b/Time/ServerTime/ServerTime.jar
new file mode 100644
index 0000000..51f0eac
Binary files /dev/null and b/Time/ServerTime/ServerTime.jar differ
diff --git a/Time/ServerTime/src/META-INF/MANIFEST.MF b/Time/ServerTime/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..25b46ff
--- /dev/null
+++ b/Time/ServerTime/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: Server
+
diff --git a/Time/ServerTime/src/Server.java b/Time/ServerTime/src/Server.java
new file mode 100644
index 0000000..9a0b74a
--- /dev/null
+++ b/Time/ServerTime/src/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(4321);
+ }
+ 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 connect");
+ 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