Skip to content

yoshiyuki-140/isPrimeNumber-gRPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

isPrimeNumber-gRPC

gRPCの実験として、素数判定のプロシージャを呼ぶサンプルを作成しました。 server-pyはPythonのバージョンのgRPCサーバーで、server-goはGoのバージョンのgRPCサーバーです。 client-pyはPythonのバージョンのgRPCクライアントです。 もし、Pythonのみで実行したい場合は、server-goを実行する必要はありませんし、 Goの環境構築を行う必要はありません。
以下はセットアップの方法です。

Server side Setup (Go)

# use `go mod tidy` to install dependencies
go mod tidy

If you want to install dependencies manually

# install grpc
go get -u google.golang.org/grpc
# install protoc's go plugin
go get -u github.com/golang/protobuf/protoc-gen-go
# 

Server side Setup (Python)

# if you want to activate virtual environment
python -m venv venv
# install dependencies
python -m pip -r requirements.txt
cd server-py
# execute
python server.py

Client side Setup (Python)

# if you want to activate virtual environment
python -m venv venv
# install dependencies
python -m pip -r requirements.txt
cd client-py
# execute
python client.py

Usage

Server side

cd server-go
go run server.go

Or

cd server-py
python server.py

Client side

cd client-py
python client.py

参考文献