Created
February 12, 2012 14:34
-
-
Save notedit/1808851 to your computer and use it in GitHub Desktop.
test_client
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"gogobservice" | |
"net/rpc" | |
"log" | |
) | |
func main(){ | |
client,err := rpc.Dial("tcp",":9000") | |
args := gogobservice.Args{7,8} | |
var reply int | |
err = client.Call("Arith.Multiply",args,&reply) | |
if err != nil { | |
log.Fatal("arith error:",err) | |
} | |
fmt.Printf("Arith: %d*%d=%d",args.A,args.B,reply) | |
quotient := new(gogobservice.Quotient) | |
divCall := client.Go("Arith.Divide",args,"ient,nil) | |
<-divCall.Done | |
fmt.Printf("%#v\n",quotient) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment