Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ce-dric/grpc-cpp-python
https://github.com/ce-dric/grpc-cpp-python
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/ce-dric/grpc-cpp-python
- Owner: ce-dric
- Created: 2024-04-02T03:43:22.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-04-03T03:10:48.000Z (10 months ago)
- Last Synced: 2024-11-14T21:12:19.122Z (2 months ago)
- Language: Python
- Size: 302 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# C++, How to communicate with Python?
Communicate with the cpp program while the Python server is running.using `gRPC` protocols
### Installation
1. CPP
```shell
> git clone https://github.com/Microsoft/vcpkg.git vcpkg
> cd .\vcpkg
> powershell.exe .\bootstrap-vcpkg.bat# c++ 17
> git checkout be1e1b72e7c5a9a07268c99c4a50d2ace0e2b469 -- ports/abseil
> cd .\triplets
# in x64-windows-static.cmake, x64-windows.cmake
# append belows
> set(VCPKG_CXX_FLAGS "/std:c++17")
> set(VCPKG_C_FLAGS "")
> cd ..> .\vcpkg install abseil:x64-windows
> .\vcpkg install grpc:x64-windows
> .\vcpkg integrate install
```2. Python
```shell
> python -m venv my_env
> my_env\Scripts\activate
(my_env) > pip install grpcio
(my_env) > pip install grpcio-tools
```### Compile, Build
1. Client
```shell
> %CD%\..\vcpkg\installed\x64-windows\tools\protobuf\protoc.exe --proto_path=%CD% --cpp_out=%CD% --grpc_out=%CD% --plugin=protoc-gen-grpc=%CD%\..\vcpkg\installed\x64-windows\tools\grpc\grpc_cpp_plugin.exe %CD%\service.proto
```2. Server
```shell
(my_env) > python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. service.proto
```### Usage
![alt text](image.png)