dongqie2028 2019-02-13 04:24
浏览 622

如何在grpc go中实现非阻塞客户端?

I want to run different remote procedure on different servers without waiting for a reply from server. and as a server completes the procedure I want to have reply at the client. Can it be possible to do with grpc golang?

I want to implement a blockchain network and I want to ask different peers to execute a transaction but I don't want to wait until one peer provides the output of execution and then I move to other peer.

In other word I want to broadcast the execution of procedure and then have all the answers as execution is being done.

I tried the common methods for connecting client and server but it waits for the response from the server. it will increase the time when execution needs to be done on more peers.

  • 写回答

2条回答 默认 最新

  • douhan4812 2019-02-13 07:36
    关注

    You can use

    go func(){}()
    

    to do async jobs, and you can easy control async tasks with sync built-in package or use channels to control or sync tasks with it.

    https://golang.org/pkg/sync/

    https://gobyexample.com/channels

    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效