Archived
1
0
Fork 0

🐛 Fix client not connecting

This commit is contained in:
Simon V. Lejel 2024-02-10 14:25:45 +01:00
parent 9b2706ed81
commit 2a5a735fde
Signed by: sl
GPG key ID: 6544A0430A2CFFAD

View file

@ -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: ";