From 52d95878e8f2b5988e5cfda8c351aa63922a6f9c Mon Sep 17 00:00:00 2001 From: Serafim Date: Sat, 14 Dec 2024 06:40:39 +0300 Subject: [PATCH] fix reading req --- client/client | Bin 31488 -> 31488 bytes client/client.cpp | 2 +- log_data/2024-12-12.log | 151 ---------------------------------------- log_data/2024-12-14.log | 41 +++++++---- server1/server.cpp | 3 +- server2/server | Bin 60992 -> 60992 bytes server2/server.cpp | 3 +- 7 files changed, 32 insertions(+), 168 deletions(-) delete mode 100644 log_data/2024-12-12.log diff --git a/client/client b/client/client index 2e727e470178d31e0a26f923d72d2d65565528ad..b63c130b0e5d5d8249768a86c54d3148335be7bf 100755 GIT binary patch delta 804 zcmYMyT}YEr7zgn4Y;$dx(P*T#U`EqHh;!52%tCA5>dne7f{+Bg2#k;hGm7TIf?$;L zc##m4IOt}9_TJb{B<*6D7j+TkMUiM9M39#G(Fad|C)F9}|9jqZ&U<*z`>ub5`d4VY znanA(DzuaqB^O!ZM>jA3$=7vXteuG)XKvk@h#Wd-_?#chG`8f%ELvKBxR!2f)AfVJ z$%eXW&w(2B+G@AQr`#TIbq#)QrO2jl^pR4P*f;xHqz85St;jIU!YsTrFVYUX7eu;r zN@d=OEWqS@5r3*STxMy0+ki&Vkl?;<&@Z-EQ&bP|ODH>98g4#EI@00-bA%s}f3 z)?q_0Y=fs@51fW+_z7mAS{0drIk*fzK&wHi9cvTB}RQc zZQWv08+W&1ypop+Yc0Y3J74U^^Vl#uh>48_4)jTm1?^`*Grtm&G&lO=iHF6LcC+E2)mIkjv>!-Z^TKDw2{a;y;jziFQUgh7jscuvmCowfvraq gF7y9C_H4py9{1xcXyd%A&uh*_Hm`Ep$-aBKKeib#u)@4V+cdwI`!*O8@;ERFa` zOKNJRCG{GrprXXV)!Tn^m*I=GYTK1tH>bl#uiv#iJMl8)tF?5O=xO7D-PEl=^7LBT z-MhRyD{;9M*^T@6ky2anoUv(bF=)E3z5gjQOXzE&gpA zVH*7q`-2W@;y5zFDdZ_0K*sof&{3*=5UIw=snEK@^M=6Me4~ff6qr@+*L9fpFoklp zrJ?P`a~p8tcC7YdAy?o;pWrwOY@9-# // IP address of the server1 -std::string SERVER_IP1 = "127.0.0.1"; +std::string SERVER_IP1 = "94.250.253.128"; // Port of the server1 int PORT1 = 9001; diff --git a/log_data/2024-12-12.log b/log_data/2024-12-12.log deleted file mode 100644 index 0078a10..0000000 --- a/log_data/2024-12-12.log +++ /dev/null @@ -1,151 +0,0 @@ -2024/12/12 19:56:03 Creating socket... -2024/12/12 19:56:03 Socket created -2024/12/12 19:56:03 Listening for connections... -2024/12/12 19:56:10 New connection accepted -2024/12/12 19:56:10 New thread created for socket 5 -2024/12/12 19:56:12 Got new message from client 5: -2024/12/12 19:56:12 Sent new info to client 5 -2024/12/12 19:56:14 Got new message from client 5: -2024/12/12 19:56:15 Got new message from client 5: -2024/12/12 19:56:16 Got new message from client 5: -2024/12/12 19:56:16 Sent new info to client 5 -2024/12/12 19:56:18 Got new message from client 5: -2024/12/12 19:56:18 Client 5 info is not up to dateSent new info to client 5 -2024/12/12 19:56:19 Got new message from client 5: -2024/12/12 19:56:19 Actual info already on client 5 -2024/12/12 19:56:20 Got new message from client 5: -2024/12/12 19:56:20 Sent new info to client 5 -2024/12/12 19:56:21 Got new message from client 5: -2024/12/12 19:56:21 Sent new info to client 5 -2024/12/12 19:56:22 Got new message from client 5: -2024/12/12 19:56:23 Got new message from client 5: -2024/12/12 19:56:23 Client 5 info is not up to dateSent new info to client 5 -2024/12/12 19:56:24 Got new message from client 5: -2024/12/12 19:56:24 Sent new info to client 5 -2024/12/12 19:56:25 Got new message from client 5: -2024/12/12 19:56:26 Got new message from client 5: -2024/12/12 19:56:26 Client 5 info is not up to date -2024/12/12 19:56:26 Sent new info to client 5 -2024/12/12 19:56:27 Got new message from client 5: -2024/12/12 19:56:27 Sent new info to client 5 -2024/12/12 19:56:28 Got new message from client 5: -2024/12/12 19:56:29 Got new message from client 5: -2024/12/12 19:56:29 Sent new info to client 5 -2024/12/12 19:56:30 Got new message from client 5: -2024/12/12 19:56:31 Got new message from client 5: -2024/12/12 19:56:32 Got new message from client 5: -2024/12/12 19:56:32 Client 5 info is not up to dateSent new info to client 5 -2024/12/12 19:56:33 Got new message from client 5: -2024/12/12 19:56:33 Sent new info to client 5 -2024/12/12 19:56:34 Got new message from client 5: -2024/12/12 19:56:35 Got new message from client 5: -2024/12/12 19:56:35 Sent new info to client 5 -2024/12/12 19:56:36 Got new message from client 5: -2024/12/12 19:56:36 Client 5 info is not up to date -2024/12/12 19:56:36 Sent new info to client 5 -2024/12/12 19:56:37 Got new message from client 5: -2024/12/12 19:56:38 Got new message from client 5: -2024/12/12 19:56:38 Sent new info to client 5 -2024/12/12 19:56:39 Got new message from client 5: -2024/12/12 19:56:39 Client 5 info is not up to date -2024/12/12 19:56:39 Sent new info to client 5 -2024/12/12 19:56:40 Got new message from client 5: -2024/12/12 19:56:40 Actual info already on client 5 -2024/12/12 19:56:40 Connection with client 5 closed -2024/12/12 19:57:04 Creating socket... -2024/12/12 19:57:04 Socket created -2024/12/12 19:57:04 Listening for connections... -2024/12/12 19:57:10 New connection accepted -2024/12/12 19:57:10 New thread created for socket 5 -2024/12/12 19:57:12 Got new message from client 5: -2024/12/12 19:57:12 Client 5 info is not up to date -2024/12/12 19:57:12 Sent new info to client 5 -2024/12/12 19:57:13 Got new message from client 5: -2024/12/12 19:57:13 Sent new info to client 5 -2024/12/12 19:57:14 Got new message from client 5: -2024/12/12 19:57:15 Got new message from client 5: -2024/12/12 19:57:15 Client 5 info is not up to date -2024/12/12 19:57:15 Sent new info to client 5 -2024/12/12 19:57:16 Got new message from client 5: -2024/12/12 19:57:16 Sent new info to client 5 -2024/12/12 19:57:17 Got new message from client 5: -2024/12/12 19:57:18 Got new message from client 5: -2024/12/12 19:57:18 Sent new info to client 5 -2024/12/12 19:57:19 Got new message from client 5: -2024/12/12 19:57:19 Client 5 info is not up to date -2024/12/12 19:57:19 Sent new info to client 5 -2024/12/12 19:57:20 Got new message from client 5: -2024/12/12 19:57:20 Actual info already on client 5 -2024/12/12 19:57:21 Got new message from client 5: -2024/12/12 19:57:21 Sent new info to client 5 -2024/12/12 19:57:22 Got new message from client 5: -2024/12/12 19:57:23 Got new message from client 5: -2024/12/12 19:57:24 Got new message from client 5: -2024/12/12 19:57:25 Got new message from client 5: -2024/12/12 19:57:26 Got new message from client 5: -2024/12/12 19:57:27 Got new message from client 5: -2024/12/12 19:57:27 Client 5 info is not up to dateSent new info to client 5 -2024/12/12 19:57:28 Got new message from client 5: -2024/12/12 19:57:28 Sent new info to client 5 -2024/12/12 19:57:29 Got new message from client 5: -2024/12/12 19:57:29 Actual info already on client 5 -2024/12/12 19:57:30 Got new message from client 5: -2024/12/12 19:57:30 Client 5 info is not up to date -2024/12/12 19:57:30 Sent new info to client 5 -2024/12/12 19:57:31 Got new message from client 5: -2024/12/12 19:57:31 Client 5 info is not up to dateSent new info to client 5 -2024/12/12 19:57:32 Got new message from client 5: -2024/12/12 19:57:33 Got new message from client 5: -2024/12/12 19:57:33 Client 5 info is not up to date -2024/12/12 19:57:33 Sent new info to client 5 -2024/12/12 19:57:34 Got new message from client 5: -2024/12/12 19:57:34 Client 5 info is not up to dateSent new info to client 5 -2024/12/12 19:57:35 Got new message from client 5: -2024/12/12 19:57:36 Got new message from client 5: -2024/12/12 19:57:36 Sent new info to client 5 -2024/12/12 19:57:37 Got new message from client 5: -2024/12/12 19:57:37 Sent new info to client 5 -2024/12/12 19:57:38 Got new message from client 5: -2024/12/12 19:57:38 Actual info already on client 5 -2024/12/12 19:57:39 Got new message from client 5: -2024/12/12 19:57:39 Sent new info to client 5 -2024/12/12 19:57:40 Got new message from client 5: -2024/12/12 19:57:40 Sent new info to client 5 -2024/12/12 19:57:41 Got new message from client 5: -2024/12/12 19:57:41 Actual info already on client 5 -2024/12/12 19:57:42 Got new message from client 5: -2024/12/12 19:57:42 Sent new info to client 5 -2024/12/12 19:57:42 Connection with client 5 closed -2024/12/12 20:00:42 Socket created -2024/12/12 20:00:49 New thread created for socket 5 -2024/12/12 20:00:55 Got new message from client 5 -2024/12/12 20:00:55 Sent new info to client -2024/12/12 20:00:58 Got new message from client 5 -2024/12/12 20:00:58 Sent new info to client -2024/12/12 20:01:00 Got new message from client 5 -2024/12/12 20:01:03 Got new message from client 5 -2024/12/12 20:01:03 Sent new info to client -2024/12/12 20:01:04 Got new message from client 5 -2024/12/12 20:01:04 Sent new info to client -2024/12/12 20:01:05 Got new message from client 5 -2024/12/12 20:01:06 Got new message from client 5 -2024/12/12 20:01:07 Got new message from client 5 -2024/12/12 20:01:07 Sent new info to client -2024/12/12 20:01:08 Got new message from client 5 -2024/12/12 20:01:08 Actual info already on client -2024/12/12 20:01:09 Got new message from client 5 -2024/12/12 20:01:09 Sent new info to client -2024/12/12 20:01:10 Got new message from client 5 -2024/12/12 20:01:10 Sent new info to client -2024/12/12 20:01:11 Got new message from client 5 -2024/12/12 20:01:11 Actual info already on client -2024/12/12 20:01:12 Got new message from client 5 -2024/12/12 20:01:13 Got new message from client 5 -2024/12/12 20:01:14 Got new message from client 5 -2024/12/12 20:01:14 Actual info already on client -2024/12/12 20:01:21 Connection with client 5 closed -2024/12/12 20:14:22 Socket created -2024/12/12 20:14:31 New thread created for socket 4 -2024/12/12 20:14:49 Got new message from client 4 -2024/12/12 20:14:54 Connection with client 4 closed -2024/12/12 20:22:52 New thread created for socket 4 diff --git a/log_data/2024-12-14.log b/log_data/2024-12-14.log index eb41eab..0939b84 100644 --- a/log_data/2024-12-14.log +++ b/log_data/2024-12-14.log @@ -1,14 +1,27 @@ -2024/12/14 02:47:49 Socket created -2024/12/14 02:47:58 Socket created -2024/12/14 02:48:44 New thread created for socket 4 -2024/12/14 02:48:55 Got new message from client 4 -2024/12/14 02:49:26 Got new message from client 4 -2024/12/14 02:49:26 Sent new info to client -2024/12/14 02:50:05 Socket created -2024/12/14 02:50:08 New thread created for socket 4 -2024/12/14 02:50:17 Got new message from client 4 -2024/12/14 02:50:17 uwu -2024/12/14 02:50:27 Got new message from client 4 -2024/12/14 02:51:36 Connection with client 4 closed -2024/12/14 02:51:56 Socket created -2024/12/14 02:51:58 Socket created +2024/12/14 02:58:09 Socket created +2024/12/14 02:59:00 New thread created for socket 4 +2024/12/14 02:59:09 Got new message from client 4 +2024/12/14 02:59:09 last_error +2024/12/14 02:59:49 Got new message from client 4 +2024/12/14 03:00:35 Connection with client 4 closed +2024/12/14 03:02:02 New thread created for socket 5 +2024/12/14 03:02:12 Got new message from client 5 +2024/12/14 03:02:12 cursor_position +2024/12/14 03:02:15 Got new message from client 5 +2024/12/14 03:02:15 cursor_position +2024/12/14 03:02:18 Got new message from client 5 +2024/12/14 03:02:21 Got new message from client 5 +2024/12/14 03:02:21 Sent new info to client +2024/12/14 03:02:24 Got new message from client 5 +2024/12/14 03:02:24 cursor_position +2024/12/14 03:02:24 Sent new info to client +2024/12/14 03:02:27 Got new message from client 5 +2024/12/14 03:02:27 cursor_position +2024/12/14 03:02:30 Got new message from client 5 +2024/12/14 03:02:30 cursor_position +2024/12/14 03:02:33 Got new message from client 5 +2024/12/14 03:02:33 cursor_position +2024/12/14 03:02:33 Sent new info to client +2024/12/14 03:02:36 Got new message from client 5 +2024/12/14 03:02:36 cursor_position +2024/12/14 03:02:38 Connection with client 5 closed diff --git a/server1/server.cpp b/server1/server.cpp index 44afb39..3f92bce 100644 --- a/server1/server.cpp +++ b/server1/server.cpp @@ -212,7 +212,8 @@ void* handle_connection(void* arg) { while (true) { // Recieve message from client char buffer[128]; - ssize_t bytes_recieved = recv(client_socket, buffer, sizeof(buffer), 0); + ssize_t bytes_recieved = recv(client_socket, buffer, sizeof(buffer) - 1, 0); + buffer[bytes_recieved] = '\0'; // If connection closed if (bytes_recieved == 0) { diff --git a/server2/server b/server2/server index 4eb930eebf5344c26c75de6cb4477e9f7542eff2..a3beb3ffaf83dbf9650748e039114c9300d80790 100755 GIT binary patch delta 7049 zcmZ`;dt6l2_CI^@2pCU=fdOH_7b+o)#S^2;~v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+J!+T!!7hc$*Zrd`@U$ZTewW6Eb_&+rsqd%ScZ9m4&6WbBS z#!&c<%WN~beR+)KP|=rR`h!yx;`Ry%5gv+zT=Li%sUP{SA`Vow->BM=l(aLFWm5jm zF#RVinv16PS7gaXc`3Vwpofe9IwFqPv@yReoBPucX{PJjS9uVR$k>-m`%DQc|uLizah! znEvim#k@+L^}9h~v(qKmyh9ba3s@{o+UtcXChyH)*U8Nmrho6LT25=L%ra1v%}f8+ zY=x|o%4uw;Xy2j5&|Xosm?Hlbs@j2+Ym3wusm$wC?M5s(-$-}JV;|2VWM3FApRxNQ z*%jIZ$tRS*FM$PL#wO-nxzo j|NRBD_rMBG^-Np;gZ^EaH%+=5=9Z%x=h)WV-RAUvkX8Ep diff --git a/server2/server.cpp b/server2/server.cpp index f738e5d..057e408 100644 --- a/server2/server.cpp +++ b/server2/server.cpp @@ -212,7 +212,8 @@ void* handle_connection(void* arg) { while (true) { // Recieve message from client char buffer[128]; - ssize_t bytes_recieved = recv(client_socket, buffer, sizeof(buffer), 0); + ssize_t bytes_recieved = recv(client_socket, buffer, sizeof(buffer) - 1, 0); + buffer[bytes_recieved] = '\0'; // If connection closed if (bytes_recieved == 0) {