diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-05-20 13:47:37 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-05-20 13:47:37 +0200 |
commit | db8906d54cd9afbc57f0b40a0d618335c552f704 (patch) | |
tree | 86f6365f3770c02e1c9a772f338b20553dc6e454 /client/main.cpp | |
parent | 27c8d89359b8d5e97c4c23ff464d5f3de7279709 (diff) |
back-and-forth in C++ w/o netcat
Diffstat (limited to 'client/main.cpp')
-rw-r--r-- | client/main.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/client/main.cpp b/client/main.cpp index c01dbb5..5c26107 100644 --- a/client/main.cpp +++ b/client/main.cpp @@ -6,6 +6,8 @@ #include "rl.h" #include "sock.h" +PBSocket* sock; + int main(int argc, char** argv) { if (argc < 2) { printf("usage: %s addr [port]\n", argv[0]); @@ -17,16 +19,20 @@ int main(int argc, char** argv) { uint16_t port = 9191; if (argc >= 3) port = atoi(argv[2]); - PBSocket sock(addr, port); + sock = new PBSocket(addr, port); try { // connect to TCP socket (automatically spawns thread) - sock.sock_connect(); + sock->sock_connect(); } 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(); + int ret = cli_main(); + + delete sock; + + return ret; } |