aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-05-20 13:33:25 +0200
committerlonkaars <loek@pipeframe.xyz>2024-05-20 13:33:25 +0200
commit27c8d89359b8d5e97c4c23ff464d5f3de7279709 (patch)
tree4216d0beffa74d87fd2802c40c4dc47ca3d9e4d3
parent41ed6fa61a65432843feb596726026bc5772ae19 (diff)
fix bad file descriptor error
-rw-r--r--client/main.cpp3
-rw-r--r--client/sock.cpp1
2 files changed, 2 insertions, 2 deletions
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() {