File: README.cn.md

package info (click to toggle)
grpc 1.51.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 76,144 kB
  • sloc: cpp: 361,866; python: 72,206; ansic: 37,778; objc: 12,434; ruby: 11,521; sh: 7,652; php: 7,615; makefile: 3,481; xml: 3,246; cs: 1,836; javascript: 1,614; java: 465; pascal: 227; awk: 132
file content (36 lines) | stat: -rw-r--r-- 1,009 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Data transmission demo for using gRPC in Python

在Python中使用gRPC时, 进行数据传输的四种方式  [官方指南](<https://grpc.io/docs/guides/concepts/#unary-rpc>)

- #### 一元模式

  在一次调用中, 客户端只能向服务器传输一次请求数据, 服务器也只能返回一次响应

  `client.py: simple_method`

  `server.py: SimpleMethod`

- #### 客户端流模式

  在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应

  `client.py: client_streaming_method `

  `server.py: ClientStreamingMethod`

- #### 服务端流模式 

  在一次调用中, 客户端只能向服务器传输一次请求数据, 但是服务器可以多次返回响应

  `client.py: server_streaming_method`

  `server.py: ServerStreamingMethod`

- #### 双向流模式

  在一次调用中, 客户端和服务器都可以向对方多次收发数据

  `client.py: bidirectional_streaming_method`

  `server.py: BidirectionalStreamingMethod`