dongtan7639 2019-01-10 22:32
浏览 1330


I have grpc server written in Go and I am trying to update receive and send message size to 20MB instead of the default 4MB with the following code

var s *grpc.Server
s = grpc.NewServer(grpc.MaxRecvMsgSize(1024*1024*20), grpc.MaxSendMsgSize(1024*1024*20))


But the above doesn't seem to be working as I still get an error when I tried to call from a client received message larger than max (5807570 vs. 4194304)" Not sure whats overriding the size

  • 写回答

1条回答 默认 最新

  • douming4359 2019-01-11 02:45

    I haven't had the chance to test this yet but have you tried adding the same options from the client stub? The same options can be attached as dial options:

    maxMsgSize := 1024*1024*20
    conn, err := grpc.Dial(address, grpc.WithDefaultCallOptions(grpc.MaxRecvMsgSize(maxMsgSize), grpc.MaxSendMsgSize(maxMsgSize)))
    if err != nil {
        // ...
    defer conn.close()
    client := pb.NewProductClient(conn)
    // ...

    I don't know anything about your use case but if your response data can be delivered piece wise then the streaming APIs might be useful.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥50 关于#微信小程序#的问题:微信小程序支持h5实现webrtc h264 h265低延迟传输渲染,能付费帮我们解决一下吗
  • ¥20 请问ansys License manager 这个问题如何解决
  • ¥15 memory.limit()' is no longer supported
  • ¥15 基于stm32f4产生两路pwm信号并可由串口通信调节
  • ¥15 C++/QT设置函数调用条件(多个功能调用同一,且各自调用条件不同)
  • ¥15 UE5样条线生成的网格UV问题
  • ¥15 如何用最短的时间大致看懂springboot+vue的项目
  • ¥15 (有偿)懂数值分析和含时变参数微分方程的来
  • ¥15 abaqus随机生成二维颗粒
  • ¥15 安装ansys许可证管理器时出现了这个问题,如何解决?