mirror of https://github.com/grpc/grpc.git
parent
55f1899d78
commit
d5810a155b
3 changed files with 72 additions and 28 deletions
@ -0,0 +1,36 @@ |
||||
## Data transmission demo for using gRPC in Python |
||||
|
||||
在Python中使用gRPC时, 进行数据传输的四种方式。 |
||||
|
||||
- #### 简单模式 |
||||
|
||||
没啥好说的,跟调普通方法没差 |
||||
|
||||
`client.py - line:13 - simple_method` |
||||
|
||||
`server.py - line:17 - SimpleMethod` |
||||
|
||||
- #### 客户端流模式 |
||||
|
||||
在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. |
||||
|
||||
`clien.py - line:24 - client_streaming_method ` |
||||
|
||||
`server.py - line:25 - ClientStreamingMethod` |
||||
|
||||
- #### 服务端流模式 |
||||
|
||||
在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 |
||||
|
||||
`clien.py - line:42 - server_streaming_method` |
||||
|
||||
`server.py - line:35 - ServerStreamingMethod` |
||||
|
||||
- #### 双向流模式 |
||||
|
||||
在一次调用中, 客户端和服务器都可以向对方多次收发数据 |
||||
|
||||
`client.py - line:55 - bidirectional_streaming_method` |
||||
|
||||
`server.py - line:51 - BidirectionalStreamingMethod` |
||||
|
@ -0,0 +1,36 @@ |
||||
## Data transmission demo for using gRPC in Python |
||||
|
||||
Four ways of data transmission when gRPC is used in Python. |
||||
|
||||
- #### unary-unary |
||||
|
||||
There's nothing to say. It's no different from the usual way. |
||||
|
||||
`client.py - line:13 - simple_method` |
||||
|
||||
`server.py - line:17 - SimpleMethod` |
||||
- #### stream-unary |
||||
|
||||
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. |
||||
|
||||
`clien.py - line:24 - client_streaming_method` |
||||
|
||||
`server.py - line:25 - ClientStreamingMethod` |
||||
|
||||
- #### unary-stream |
||||
|
||||
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. |
||||
|
||||
`clien.py - line:42 - server_streaming_method` |
||||
|
||||
`server.py - line:35 - ServerStreamingMethod` |
||||
|
||||
- #### stream-stream |
||||
|
||||
In a single call, both client and server can send and receive data |
||||
to each other multiple times. |
||||
|
||||
`client.py - line:55 - bidirectional_streaming_method` |
||||
|
||||
`server.py - line:51 - BidirectionalStreamingMethod` |
||||
|
@ -1,28 +0,0 @@ |
||||
## Demo for using gRPC in Python |
||||
|
||||
在Python中使用gRPC时, 进行数据传输的四种方式。(Four ways of data transmission when gRPC is used in Python.) |
||||
|
||||
- #### 简单模式 (unary-unary) |
||||
```text |
||||
没啥好说的,跟调普通方法没差 |
||||
There's nothing to say. It's no different from the usual way. |
||||
``` |
||||
- #### 客户端流模式 (stream-unary) |
||||
```text |
||||
在一次调用中, 客户端可以多次向服务器传输数据, 但是服务器只能返回一次响应. |
||||
In a single call, the client can transfer data to the server several times, |
||||
but the server can only return a response once. |
||||
``` |
||||
- #### 服务端流模式 (unary-stream) |
||||
```text |
||||
在一次调用中, 客户端只能一次向服务器传输数据, 但是服务器可以多次返回响应 |
||||
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. |
||||
``` |
||||
- #### 双向流模式 (stream-stream) |
||||
```text |
||||
在一次调用中, 客户端和服务器都可以向对方多次收发数据 |
||||
In a single call, both client and server can send and receive data |
||||
to each other multiple times. |
||||
``` |
||||
|
Loading…
Reference in new issue