RpcCommunicator.h 467 B

123456789101112131415161718192021222324
  1. #ifndef NET_RPC_COMMUNICATOR_H
  2. #define NET_RPC_COMMUNICATOR_H
  3. #include <boost/asio.hpp>
  4. namespace Hainan {
  5. class RpcRequest;
  6. class RpcCommunicator
  7. {
  8. private:
  9. boost::asio::io_service io_service;
  10. boost::asio::ip::tcp::socket socket;
  11. public:
  12. RpcCommunicator(std::string& host, int port);
  13. ~RpcCommunicator();
  14. void AsyncWrite(boost::asio::buffer& buffer,
  15. boost::function<void (const boost::asio::error_code&)> handler);
  16. };
  17. }
  18. #endif // NET_RPC_COMMUNICATOR_H