-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.cpp
36 lines (27 loc) · 838 Bytes
/
main.cpp
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
30
31
32
33
34
35
36
//#include "src/tool/public.h"
//#include "src/tool/public_h.h"
#include <thread>
#include "src/SocketAdvance/GetTime.h"
void thread_func() {
SocketClient<int> client;
while (true) {
int request, response;
std::cout << "please input a int number: ";
std::cin >> request;
if (std::cin.fail()) {
std::cin.clear();
std::cin.ignore();
std::cout << "input error" << std::endl;
continue;
}
client.sendMessage(request, response);
std::cout << "send: " << request << " resp" << response << std::endl;
}
}
int main(int argc, char** argv) {
// printf("%s:%d begain.\n", __func__, __LINE__);
std::thread fun(thread_func);
SocketServer<int> ser;
ser.start();
// printf("%s:%d end.\n", __func__, __LINE__);
}