// // Created by zx on 2019/12/17. // #include "MeasureRequest.h" #include #include #include #include #include #include MeasureRequest::MeasureRequest(std::string connectStr) { m_connect_str=connectStr; } bool MeasureRequest::Request(std::string cmd,std::string& response) { nnxx::socket sock{ nnxx::SP, nnxx::REQ }; sock.connect(m_connect_str); sock.send(cmd); nnxx::message message; try { nnxx::with_recv_timeout _ { sock, std::chrono::milliseconds(1000) }; message=sock.recv(); } catch (const nnxx::timeout_error &) { return false; } catch (const std::exception &) { return false; } response=nnxx::to_string(message); return true; }