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

    评论

报告相同问题?

悬赏问题

  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题