Skip to content

Commit e73c7e9

Browse files
committed
Main method
1 parent bbf7e27 commit e73c7e9

File tree

8 files changed

+46
-3
lines changed

8 files changed

+46
-3
lines changed

RemoteMonitor Desktop/.idea/artifacts/untitled104_jar.xml

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Main-Class: com.company.Main
3+

RemoteMonitor Desktop/src/main/java/com/company/Main.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,28 @@ public static void main(String[] args) throws Exception {
1313
System.out.println("Local connection IP: " + configurationManager.getLocalIp() + " Port: " + configurationManager.getPort());
1414
System.out.println("Keyword: " + configurationManager.getKeyword());
1515
server.start();
16+
System.out.println(server.getConnectedIp() + " successfully connected");
1617

18+
System.out.println();
1719
while (server.isConnected())
1820
{
19-
21+
String read = server.read();
22+
23+
if (read.equals("data request"))
24+
{
25+
System.out.println("Client requested data");
26+
componentManager.updateAll();
27+
28+
if (server.write(componentManager.toJson()))
29+
{
30+
System.out.println("Successfully sent data to the client");
31+
}else
32+
{
33+
System.out.println("Failed to send data to the client");
34+
}
35+
}
2036
}
21-
37+
System.out.println("Connection disconnected");
2238

2339

2440

RemoteMonitor Desktop/src/main/java/networking/Server.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ public Boolean write(String json) throws IOException {
5151
return false;
5252
}
5353

54+
public String read() throws IOException {
55+
return reader.readLine();
56+
}
5457
public Boolean checkAuthed() throws IOException
5558
{
56-
String input = reader.readLine();
59+
String input = read();
5760
if (input != null){
5861
if (input.equals(keyword))
5962
{
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Manifest-Version: 1.0
2+
Main-Class: com.company.Main
3+
741 Bytes
Binary file not shown.
179 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)