Closed bbuugg closed 11 months ago
d := client.NewPeer2PeerDiscovery("tcp@"+*addr2, "") xclient := client.NewXClient("Arith", client.Failtry, client.RandomSelect, d, client.DefaultOption) defer xclient.Close() args := &example.Args{ A: 10, B: 20, } reply := &example.Reply{} call, err := xclient.Go(context.Background(), "Mul", args, reply, nil) if err != nil { log.Fatalf("failed to call: %v", err) } replyCall := <-call.Done if replyCall.Error != nil { log.Fatalf("failed to call: %v", replyCall.Error) } else { log.Printf("%d * %d = %d", args.A, args.B, reply.C) }
执行client.go 后一直阻塞了,但是用xclient.Call是没有问题的。
执行client.go 后一直阻塞了,但是用xclient.Call是没有问题的。