diff --git a/client/client b/client/client index 2e727e4..b63c130 100755 Binary files a/client/client and b/client/client differ diff --git a/client/client.cpp b/client/client.cpp index 9526df3..1245013 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -9,7 +9,7 @@ #include // 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 4eb930e..a3beb3f 100755 Binary files a/server2/server and b/server2/server differ 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) {