diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-20 13:24:13 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-20 13:24:13 +0200 |
commit | 41ed6fa61a65432843feb596726026bc5772ae19 (patch) | |
tree | 9f141d6c4fbaee4e4bed380d9b80f4a1c65d9ed8 /client/main.cpp | |
parent | 5876e74fa32881b41478cd67c5b0895161fbdc9c (diff) |
socket connect working (sorta)
Diffstat (limited to 'client/main.cpp')
-rw-r--r-- | client/main.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/client/main.cpp b/client/main.cpp index 6aad0e3..36fc7bb 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -1,6 +1,7 @@ #include <cstdio> #include <cstdlib> #include <cstdint> +#include <exception> #include "rl.h" #include "sock.h" @@ -16,8 +17,13 @@ int main(int argc, char** argv) { uint16_t port = 9191; if (argc >= 3) port = atoi(argv[2]); - // connect to TCP socket (automatically spawns thread) - PBSocket sock(addr, port); + try { + // connect to TCP socket (automatically spawns thread) + PBSocket sock(addr, port); + } catch (const std::exception& e) { + printf("error: %s\n", e.what()); + return EXIT_FAILURE; + } // enter main CLI (using GNU readline for comfyness) return cli_main(); |