aboutsummaryrefslogtreecommitdiff
path: root/client/sock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/sock.cpp')
-rw-r--r--client/sock.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/client/sock.cpp b/client/sock.cpp
new file mode 100644
index 0000000..703ee24
--- /dev/null
+++ b/client/sock.cpp
@@ -0,0 +1,29 @@
+#include <unistd.h>
+#include <cstdio>
+
+#include <thread>
+
+#include "sock.h"
+#include "rl.h"
+
+PBSocket::PBSocket() {
+ printf("Init PBSocket!\n");
+}
+
+PBSocket::PBSocket(char* addr, uint16_t port) : PBSocket() {
+ connect(addr, port);
+}
+
+void PBSocket::connect(char* addr, uint16_t port) {
+ printf("Connect to %s on port %d\n", addr, port);
+
+ this->_thread = std::thread(&PBSocket::sock_task, this);
+}
+
+void PBSocket::sock_task() {
+ while(1) {
+ sleep(3);
+ rl_printf("Testing asynchronous messages in prompt...\n");
+ }
+}
+