如何使用python增加grpc中的消息大小 [英] How to increase message size in grpc using python

查看:897
本文介绍了如何使用python增加grpc中的消息大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用grpc进行消息传递,并正在测试一个简单的服务器和客户端.当我的邮件大小超过限制时,会出现此错误.

I am using grpc for message passing and am testing a simple server and client. When my message size goes over the limit, I get this error.

grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with 
(StatusCode.INVALID_ARGUMENT,
 Received message larger than max (7309898 vs. 4194304))>

如何增加服务器和客户端的邮件大小?

How do I increase the message size on the server and client side?

推荐答案

更改发送和接收的message_length都可以解决问题.

Changing the message_length for both send and receive will do the trick.

channel = grpc.insecure_channel(
    'localhost:50051',
    options=[
        ('grpc.max_send_message_length', MAX_MESSAGE_LENGTH),
        ('grpc.max_receive_message_length', MAX_MESSAGE_LENGTH),
    ],
)

这篇关于如何使用python增加grpc中的消息大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆