1 Star 0 Fork 0

yonglinux / rpcx-examples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
client.go 554 Bytes
一键复制 编辑 原始数据 按行查看 历史
鸟窝 提交于 2020-01-22 17:02 . add reflection example
package main
import (
"context"
"flag"
"fmt"
"github.com/smallnest/rpcx/client"
)
var (
addr = flag.String("addr", "localhost:8972", "server address")
)
func main() {
flag.Parse()
d := client.NewPeer2PeerDiscovery("tcp@"+*addr, "")
xclient := client.NewXClient("Reflection", client.Failtry, client.RandomSelect, d, client.DefaultOption)
defer xclient.Close()
var reply string
err := xclient.Call(context.Background(), "GetService", "Arith", &reply)
if err != nil {
panic(err)
}
fmt.Printf("all registered services: %s\n", reply)
}
1
https://gitee.com/yonglinux/rpcx-examples.git
git@gitee.com:yonglinux/rpcx-examples.git
yonglinux
rpcx-examples
rpcx-examples
v1.1.6

搜索帮助

53164aa7 5694891 3bd8fe86 5694891