A little ping pong program that talks via gRPC.
Build the docker container with all necessary binaries
docker build -t grpcpingpong .
docker save grpcpingpong > grpcpingpong.tar
copy the image to the other server and do following command to load it
docker load -i grpcpingpong.tar
using docker command
docker run -d --name test -p 8090:8090 grpcpingpong server --msg "custom return message" --port 8090
using predefined docker-compose yaml
docker-compose -f docker-compose-sample.yaml up -d
docker exec -ti clitest ping-pong-grpc client --port 7051
You can run ping-pong-grpc
in server mode. In this mode it will wait for
incoming SendPing()
calls and respond with a simple Pong
message.
You can run it in server mode like this:
build/ping-pong-grpc server
You can also run ping-pong-grpc
in client mode. In this mode it will open a
connection to a instance running in server mode and send SendPing()
calls with
a Ping
message.
You can run a single ping rpc in client mode like this:
ping-pong-grpc client
Besides running a single ping rpc call you can also start the client in cycle mode which will run consecutive rpc calls with a sleep duration.
You can run the client in cycle mode like this:
ping-pong-grpc client --cycle-mode --cycle-sleep-duration=1s
All modes support multiple log levels via the --log-level
flag.