nekoray_Mahdi-zarei/3rdparty/protorpc/rpc_client.h
Mahdi 2dde7dbb2e
Migrate to protorpc (#598)
* refactor: migrate from grpc to protorpc

* fix

* fix

* fix

* cleanup

* Update mainwindow_grpc.cpp

* Update RPC.cpp

* fix

---------

Co-authored-by: parhelia512 <0011d3@gmail.com>
2025-08-02 03:19:32 -07:00

54 lines
1008 B
C++

// Copyright 2013 <chaishushan{AT}gmail.com>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#pragma once
#ifndef PROTORPC_CLIENT_H__
#define PROTORPC_CLIENT_H__
#include "3rdparty/protorpc/rpc_conn.h"
#include "3rdparty/protorpc/rpc_error.h"
#include <stdint.h>
#include <string>
namespace protorpc {
class Client {
public:
Client(const char* host, int port);
~Client();
const ::protorpc::Error CallMethod(
const std::string& method,
const ::std::string* request,
::std::string* response
);
// Close the connection
void Close();
private:
const ::protorpc::Error callMethod(
const std::string& method,
const ::std::string* request,
::std::string* response
);
bool checkMothdValid(
const std::string& method,
const ::std::string* request,
::std::string* response
) const;
std::string host_;
int port_;
Conn conn_;
uint64_t seq_;
};
} // namespace protorpc
#endif // PROTORPC_CLIENT_H__