From d2af8ca65f176def40bbd05398a05c0f5c6eaf6f Mon Sep 17 00:00:00 2001 From: esoe Date: Sat, 24 Sep 2022 22:29:47 +0300 Subject: [PATCH] qq --- src/main/java/ru/molokoin/ExchangeServer.java | 22 ++++++++++++++++-- src/main/java/ru/molokoin/UploadServer.java | 1 + src/main/webapp/upload.html | 2 ++ .../classes/ru/molokoin/ExchangeServer.class | Bin 3305 -> 3719 bytes target/classes/ru/molokoin/UploadServer.class | Bin 7260 -> 7260 bytes 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/molokoin/ExchangeServer.java b/src/main/java/ru/molokoin/ExchangeServer.java index 60db3a8..7c48459 100644 --- a/src/main/java/ru/molokoin/ExchangeServer.java +++ b/src/main/java/ru/molokoin/ExchangeServer.java @@ -10,8 +10,10 @@ import java.net.ServerSocket; import java.net.Socket; import java.nio.charset.StandardCharsets; -public class ExchangeServer { +public class ExchangeServer{ private static int port = 8081; + private static String link = "localhost"; + private static int num = 0; public static void main(String[] args) { try (ServerSocket serverSocket = new ServerSocket(port)) { @@ -21,6 +23,7 @@ public class ExchangeServer { // ожидаем подключения Socket socket = serverSocket.accept(); System.out.println("Client connected ..."); + num++; // для подключившегося клиента открываем потоки // чтения и записи @@ -32,8 +35,19 @@ public class ExchangeServer { // считываем и печатаем все что было отправлено клиентом System.out.println(); + String firstLine = null; + String querry = null; while (input.ready()) { - System.out.println(input.readLine()); + String line = input.readLine(); + if (firstLine == null){ + firstLine = line; + if(firstLine.startsWith("GET")){ + querry = "GET"; + } + System.out.println("firstLine: " + firstLine); + System.out.println("querry: " + querry); + } + System.out.println(line); } // отправляем ответ @@ -42,14 +56,17 @@ public class ExchangeServer { String fileName = "upload.html"; path = path + "/src/main/webapp/"; File file = new File(path + fileName); + //String text = ""; try (BufferedReader br = new BufferedReader(new FileReader(file))){ String line; while ((line = br.readLine()) != null) { System.out.println(line); output.println(line); + //text = text + " " + line; } output.flush(); } + catch (IOException e) { e.printStackTrace(); } @@ -57,6 +74,7 @@ public class ExchangeServer { // по окончанию выполнения блока try-with-resources потоки, // а вместе с ними и соединение будут закрыты System.out.println("Client disconnected!"); + System.out.println("num: " + num); } } } catch (IOException ex) { diff --git a/src/main/java/ru/molokoin/UploadServer.java b/src/main/java/ru/molokoin/UploadServer.java index 8e74946..368d7e7 100644 --- a/src/main/java/ru/molokoin/UploadServer.java +++ b/src/main/java/ru/molokoin/UploadServer.java @@ -13,6 +13,7 @@ package ru.molokoin; not be liable for any consequences, loss of profit or any other kind of loss, that may occur while using the product itself and/or together with any other software. + */ import java.net.*; diff --git a/src/main/webapp/upload.html b/src/main/webapp/upload.html index 03f31c1..fdfad69 100644 --- a/src/main/webapp/upload.html +++ b/src/main/webapp/upload.html @@ -1,5 +1,7 @@ HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 + +

diff --git a/target/classes/ru/molokoin/ExchangeServer.class b/target/classes/ru/molokoin/ExchangeServer.class index 17e8b816244ec4746b86f25347f29cefa9e52bf2..d9817e285bacf77d50e299959984e7d9fa0ffffe 100644 GIT binary patch literal 3719 zcma)8Yj9Lo9sixp?%sXe>?WH+xkw>YiwSvbMcTq$q(C5rHX+cYp`ny=vwOoXY<9PI z@AA+J6!BfFsI|~mD@7WuRUz0-OO#l3V1_S-@q^<>zc|y+esBhq_&fJzljS+??A&wC z|NP(2bLGZ`ivX76&k8&O^Q}^RIG@e$&1Z7)4F{5GBe&b^HLZQ7rNAptx5wCL#IuCP zdj|KINn5~M$Xi^*CT_Et++KlL*DO}AZDn%169P54(y%~aRgyRvdo=+~&HW_l$fwL8 z1R^SY@CQ&Q5X|P2MmC)<+VUc%LP0?8?o$zjUm)6*$(fr=!-J;PXAEXdDN$1N8&*c1 zr-A-ej-(K3psBbYVM?>pnWDgguDhE_RlUPTCMPhr>ABktY3^6BNMMd*Va~MUu5)_x z$-Sl>!a^*Tq8=oZrcKTLL3{>F6g+g3<9ZJkZF5+~XVFA2sv| z3?~#U6}bOaU#=@~i8gtI#USRI`m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ngb!7-x{E3CPt~QmI9_8Kq;VF* z>WCWU`mj2o#yRd(7u7|MarM4>pJPB>Q`a~`eV{%deZ7~Z&+$zLCRvDWneGhx|y*SPBWwhaSK7-!E7QBrPTqf5wbm2oJ@ev-xbv&dLA4xi| zg=QvN8jq+RK4|)oQb+hw`3K)3|HcmW5wB;djB)v@kMUEy!Bt$%;%9i1wry4Ca1K95 zfc_lBFYrs2+^~w_SNJun=q*h1_Zy<|Hm2}f&LXs89KYkbk+!68o*Xe+6vyv*8dqU* z`LiCD@dW+=opuE9N6r-fL>qM6c>|pqUiAK3=kXZA8ZIntXn1^azC&Z9MN?!RMKs-p zMuY49=V};T5Tn@B+_{d%-5jFPdFdGcj~FNoXB+0(32ti{sYG}kA61lo9pPm)fm$^p aj)b9I9Kzvw;=qjyo)XUg%y`t{;{O1&2|ok? diff --git a/target/classes/ru/molokoin/UploadServer.class b/target/classes/ru/molokoin/UploadServer.class index 48a7810f10fd03d2a6c51513cb59255a04075032..551f54770f279fcc2315a734ab372a276e89597f 100644 GIT binary patch delta 477 zcmWNO-AfYy6vcn{ni86YOwh_8L7A8>x0o9#C1j;RMk)zLAWEoY#j+1n*a$<6{6L14 zqFIXikmYcRA2g^4e2_Bx(5$`m;B)^%mkalvdk^P6oD=uQ{gDHXw0w4vODYBI=P1W; zg^xIRiJm7Zr- z>v^p$hJCHHYk)cJAfh4WwVS98@K%Rd&`FzbSkxFxy1}w;8IH4}JG_eqGiNpRJxP3E z4>(SaZ%h{l6o#n1HIBnpEQNIDn5eJ#x-f@x^&SmJ=~Bh+>#&z($AoTxh)ay zNQ}EONm!=2FKMFknFq4KL&-2Ciww&j9?3r*YYtB|pQl z8P`)x=vm_)KfM|tp?yqhh$+3vwB947QC{hD!vwE2%^RKPt!9j8nbE(zO9j_VXx@94 z@qv|mq?k_;Pf^_U#U`_?;wuh&hLbrq@ZHn}%jySP`Dyw5viD|a;J4+m7+LOY{SV_q BZNvZo