| 22 | } |
| 23 | |
| 24 | void ReadFunc(const Handle& handle, base::CBuffer* data, uint32_t len, uint32_t error) { |
| 25 | if (error != CEC_CLOSED && error != CEC_CONNECT_BREAK) { |
| 26 | std::cout << "[ReadFunc]" << std::endl; |
| 27 | std::cout << *(data) << std::endl; |
| 28 | data->Clear(); |
| 29 | std::cout << "Thread ID : " << std::this_thread::get_id() << std::endl; |
| 30 | std::cout << "Read size : " << len << std::endl << std::endl; |
| 31 | auto msg = GetMsg(); |
| 32 | handle->Write(msg.c_str(), msg.length()); |
| 33 | } else { |
| 34 | std::cout << "Close" << std::endl; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | void ConnectFunc(const Handle& handle, uint32_t err) { |
| 39 | if (err == CEC_SUCCESS) { |