From 86becee9511829e590247bc035bc1d56bca7d1df Mon Sep 17 00:00:00 2001 From: Blitblank Date: Wed, 22 Jul 2026 21:49:18 -0500 Subject: [PATCH] sync --- README.md | 4 ++-- client/config/main.cfg | 2 +- server/src/TcpServer.cpp | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0337b0c..c4a32b0 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ Similarly, a list of dependent linux packages: ## Development plan: - [x] Build & project setup, get working hello-world program. - [x] TCP Demo between client and server -- [ ] Add TLS with OpenSSL on top of the TCP -- [ ] Build and deploy server to a Docker container in a CI/CD pipeline +- [ ] Add TLS with OpenSSL on top of the TCP +- [ ] Build and deploy server to a Docker container in a CI/CD pipeline (they have windows containers 🤯) - [ ] Implement PostgreSQL interfacing for the server - [ ] Checkpoint the client<->server model for basic crud actions - [ ] Create client GUI with QML: display responded messages and textbox + button for sending diff --git a/client/config/main.cfg b/client/config/main.cfg index e4c5dd0..e09b7fc 100644 --- a/client/config/main.cfg +++ b/client/config/main.cfg @@ -24,7 +24,7 @@ TcpClient = ( { Id = "main"; - Hostname = "127.0.0.1"; + Hostname = "accordion.vxbard.net"; Port = 39500; } ); diff --git a/server/src/TcpServer.cpp b/server/src/TcpServer.cpp index 9742a11..f23b290 100644 --- a/server/src/TcpServer.cpp +++ b/server/src/TcpServer.cpp @@ -34,7 +34,7 @@ ErrorCode TcpServer::init() { struct sockaddr_in serverAddress; // ip address of the server struct sockaddr_in clientAddress; // ip address of the client - char clientIp[20]; + char clientIp[INET_ADDRSTRLEN]; int clientPort; serverSocket = socket(AF_INET, SOCK_STREAM, 0); // create the server's endpoint @@ -55,7 +55,8 @@ ErrorCode TcpServer::init() { // describe the IP address of the server memset(&serverAddress.sin_zero, 0, sizeof(serverAddress.sin_zero)); // sin_zero is padding that must be clear - serverAddress.sin_family = AF_INET; // socket-internet_family = ADDRESS_FAMILTY: INTERNET + serverAddress.sin_family = AF_INET; // socket-internet_family = ADDRESS_FAMILY: INTERNET + // TODO: switch from ipv4 to ipv6 so we can bypass the port garbage serverAddress.sin_port = htons(configuration_.port); // socket-internet_port = our port (endianess checked) serverAddress.sin_addr.s_addr = INADDR_ANY; // socket-address = 0.0.0.0 @@ -111,7 +112,7 @@ ErrorCode TcpServer::init() { // record client address if(getsockname(sockets[i].fd, (struct sockaddr *)&serverAddress, &addressSize) == 0) { struct sockaddr_in* s = (struct sockaddr_in *)&clientAddress; - inet_ntop(AF_INET, &s->sin_addr, clientIp, sizeof(clientIp)); + inet_ntop(AF_INET, &s->sin_addr, clientIp, INET_ADDRSTRLEN); clientPort = ntohs(s->sin_port); clientAddresses[i] = std::format("{}:{}", clientIp, clientPort);