blob: 703ee24e23811b5fef6bf2080b459695005f6d42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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");
}
}
|