• Home
Name
Date
Size
#Lines
LOC

..--

BUILDD12-May-20241.3 KiB5045

README.cn.mdD12-May-20241,009 3718

README.en.mdD12-May-20241 KiB3819

alts_client.pyD12-May-20241.3 KiB4018

alts_server.pyD12-May-20241.2 KiB4017

client.pyD12-May-20244.7 KiB12464

demo.protoD12-May-20243.1 KiB7059

demo_pb2.pyD12-May-20245.3 KiB175147

demo_pb2_grpc.pyD12-May-20244.5 KiB10792

server.pyD12-May-20244.4 KiB11658

README.cn.md

1## Data transmission demo for using gRPC in Python
2
3在Python中使用gRPC时, 进行数据传输的四种方式  [官方指南](<https://grpc.io/docs/guides/concepts/#unary-rpc>)
4
5- #### 一元模式
6
7  在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应
8
9  `client.py: simple_method`
10
11  `server.py: SimpleMethod`
12
13- #### 客户端流模式
14
15  在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应
16
17  `client.py: client_streaming_method `
18
19  `server.py: ClientStreamingMethod`
20
21- #### 服务端流模式
22
23  在一次调用中, 客户端只能向服务器传输一次请求数据, 但是服务器可以多次返回响应
24
25  `client.py: server_streaming_method`
26
27  `server.py: ServerStreamingMethod`
28
29- #### 双向流模式
30
31  在一次调用中, 客户端和服务器都可以向对方多次收发数据
32
33  `client.py: bidirectional_streaming_method`
34
35  `server.py: BidirectionalStreamingMethod`
36
37

README.en.md

1##  Data transmission demo for using gRPC in Python
2
3Four ways of data transmission when gRPC is used in Python.  [Official Guide](<https://grpc.io/docs/guides/concepts/#unary-rpc>)
4
5- #### unary-unary
6
7  In a single call, the client can only send request once, and the server can only respond once.
8
9  `client.py: simple_method`
10
11  `server.py: SimpleMethod`
12
13- #### stream-unary
14
15  In a single call, the client can transfer data to the server an arbitrary number of times, but the server can only return a response once.
16
17  `client.py: client_streaming_method`
18
19  `server.py: ClientStreamingMethod`
20
21- #### unary-stream
22
23  In a single call, the client can only transmit data to the server at one time, but the server can return the response many times.
24
25  `client.py: server_streaming_method`
26
27  `server.py: ServerStreamingMethod`
28
29- #### stream-stream
30
31  In a single call, both client and server can send and receive data
32  to each other multiple times.
33
34  `client.py: bidirectional_streaming_method`
35
36  `server.py: BidirectionalStreamingMethod`
37
38