From 27c8d89359b8d5e97c4c23ff464d5f3de7279709 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 20 May 2024 13:33:25 +0200 Subject: fix bad file descriptor error --- client/main.cpp | 3 ++- client/sock.cpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'client') diff --git a/client/main.cpp b/client/main.cpp index 36fc7bb..c01dbb5 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -17,9 +17,10 @@ int main(int argc, char** argv) { uint16_t port = 9191; if (argc >= 3) port = atoi(argv[2]); + PBSocket sock(addr, port); try { // connect to TCP socket (automatically spawns thread) - PBSocket sock(addr, port); + sock.sock_connect(); } catch (const std::exception& e) { printf("error: %s\n", e.what()); return EXIT_FAILURE; diff --git a/client/sock.cpp b/client/sock.cpp index 17d9e35..c10fba0 100644 --- a/client/sock.cpp +++ b/client/sock.cpp @@ -19,7 +19,6 @@ using std::thread; PBSocket::PBSocket() { } PBSocket::PBSocket(char* addr, uint16_t port) : PBSocket() { set_server(addr, port); - sock_connect(); } PBSocket::~PBSocket() { -- cgit v1.2.3