From 2a5a735fde0d34653728b2c85c0d14d0fa39565f Mon Sep 17 00:00:00 2001 From: "Simon V. Lejel" Date: Sat, 10 Feb 2024 14:25:45 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20client=20not=20connecting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/main.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/client/main.cc b/src/client/main.cc index 6cb56da..9ef0cb8 100644 --- a/src/client/main.cc +++ b/src/client/main.cc @@ -25,6 +25,15 @@ int main() { serverAdress.sin_port = htons(8080); serverAdress.sin_addr.s_addr = inet_addr("127.0.0.50"); + int connectStatus = connect(clientSocket, (struct sockaddr *)&serverAdress, + sizeof(serverAdress)); + if (connectStatus != 0) { + cout << "Failed to connect"; + return connectStatus; + } else { + cout << "CONNECTED!" << endl; + } + while (true) { Message message; cout << "Type message to server: ";